Skip to content

Instantly share code, notes, and snippets.

View KeitaTakenouchi's full-sized avatar

Takenouchi Keita KeitaTakenouchi

  • Osaka University
View GitHub Profile
import numpy as np
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
from random import randrange
xs = np.array([[1], [3.1], [2.9], [1.3], [2], [4],
[4.7], [5], [6], [7], [7.1], [7.2]])
ys = np.array([[2], [5.8], [4.2], [2.4], [4], [8],
[9.2], [9], [10], [10], [11], [12]])
#!pip install seaborn
data = {
"a" : [1,2,34,4000, 4000, 4000, 40000]
,"b" : [2,1300,3400,3400,3400,3400,340000]
,"c" : [1,10,13,3000,3000,3570,5570,8570,300000]
,"d" : [1,110,260, 300, 350, 35077]
}
import seaborn as sns
@KeitaTakenouchi
KeitaTakenouchi / Note.py
Last active April 1, 2021 14:52
Pytorch Tabular Example
# !pip install torch torchvision torchaudio
# !pip install pytorch_tabular[all]
## Prepare utility functions
from sklearn.datasets import make_classification
def make_mixed_classification(n_samples, n_features, n_categories):
X,y = make_classification(n_samples=n_samples, n_features=n_features, random_state=42, n_informative=5)
cat_cols = random.choices(list(range(X.shape[-1])),k=n_categories)
num_cols = [i for i in range(X.shape[-1]) if i not in cat_cols]
for col in cat_cols: