Skip to content

Instantly share code, notes, and snippets.

View Athospd's full-sized avatar
🏠
Working from home

Athos Petri Damiani Athospd

🏠
Working from home
View GitHub Profile
library(magrittr)
a <- system.file("waves_yesno/1_1_0_1_1_0_1_1.wav", package = "torchaudio")
# mp3 ---------------------------------------------------------------------
a <- system.file("sample_audio_1.mp3", package = "torchaudio")
mp3_bm <- bench::mark(
torchaudio:::av_read_mp3_or_wav(a) %>% torchaudio::transform_to_tensor(),
torchaudio:::tuneR_read_mp3_or_wav(a) %>% torchaudio::transform_to_tensor(),
torchaudio:::av_read_mp3_or_wav(a),
library(torch)
library(tidymodels)
# simulated data ------------------------------------------------------------
set.seed(1)
df <- tibble(
x = rnorm(500),
y = 4 + 3 * tanh(-1 + 1*x) + rnorm(500, sd = 0.25)
)
library(tidyverse)
gg_cartesian_grid <- function(width, height) {
data.frame(
x = width*c(-1, 1),
y = height*c(-1, 1)
) %>%
ggplot(aes(x, y)) +
geom_hline(yintercept = 0, colour = "white") +
geom_vline(xintercept = 0, colour = "white") +
---
title: "lightgbm"
author: "Athos"
date: "09/07/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE)
library(tidyverse) # metapackage of all tidyverse packages
#' Author: Athos Damiani
#' Subject: Teste na Live 1
library(tidyverse)
library(magrittr)
# Import -----------------------------------------------------------------------
# Tidy -------------------------------------------------------------------------
@Athospd
Athospd / xgboost-gif.R
Created April 7, 2020 22:08
generate gifs of a xgboost fit
library(tidyverse)
library(tidymodels)
library(gganimate)
theme_set(theme_minimal(20))
dados <- tibble(
x = runif(1000) - 0.5,
y = sin(x * pi * 2) + rnorm(1000, sd = 0.3)
)
trees <- 30
@Athospd
Athospd / transformer.Rmd
Created January 6, 2020 16:10
Transformer translation for R
---
title: "Transformer"
author: "Athos Petri Damiani"
date: "05/01/2020"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@Athospd
Athospd / week4_keras_generator
Created November 11, 2019 23:39
Horse-or-Human-NoValidation for TF in practice lecture from Coursera.org and deeplearning.ai
# Horse-or-Human-NoValidation.ipynb
library(zeallot)
library(reticulate)
library(purrr)
library(keras)
library(httr)
library(png)
library(rray)
library(cowplot)
library(magick)
library(tidyverse)
library(gganimate)
library(broom)
library(rsample)
library(purrr)
library(modelr)
library(magick)
set.seed(1)
library(RSQLite)
library(tidyverse)
library(dbplyr)
con <- RSQLite::dbConnect(RSQLite::SQLite(), "database.sqlite")
nome_das_tabelas <- RSQLite::dbListTables(con)
tabelas <- nome_das_tabelas %>%
map(~dbplyr::db_collect(con, glue::glue("select * from {.x}"))) %>%