Wandb and Structured Learning#

%load_ext autoreload
%autoreload 2
The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload

Imports#

from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import StratifiedKFold
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from fastai.vision.all import *
from aiking.data.external import * #We need to import this after fastai modules
import wandb
path = untar_data("kaggle_competitions::titanic"); path

# untar_data??
Path('/content/drive/MyDrive/PPV/S_Personal_Study/aiking/data/titanic')
path.ls()
(#3) [Path('/content/drive/MyDrive/PPV/S_Personal_Study/aiking/data/titanic/train.csv'),Path('/content/drive/MyDrive/PPV/S_Personal_Study/aiking/data/titanic/test.csv'),Path('/content/drive/MyDrive/PPV/S_Personal_Study/aiking/data/titanic/gender_submission.csv')]
df = pd.read_csv(path/"train.csv"); df.head()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-28-768b4736ad05> in <module>()
----> 1 df = pd.read_csv(path/"train.csv"); df.head()

TypeError: unsupported operand type(s) for /: 'NoneType' and 'str'
df.nunique()
PassengerId    891
Survived         2
Pclass           3
Name           891
Sex              2
Age             88
SibSp            7
Parch            7
Ticket         681
Fare           248
Cabin          147
Embarked         3
dtype: int64
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 891 entries, 0 to 890
Data columns (total 12 columns):
 #   Column       Non-Null Count  Dtype  
---  ------       --------------  -----  
 0   PassengerId  891 non-null    int64  
 1   Survived     891 non-null    int64  
 2   Pclass       891 non-null    int64  
 3   Name         891 non-null    object 
 4   Sex          891 non-null    object 
 5   Age          714 non-null    float64
 6   SibSp        891 non-null    int64  
 7   Parch        891 non-null    int64  
 8   Ticket       891 non-null    object 
 9   Fare         891 non-null    float64
 10  Cabin        204 non-null    object 
 11  Embarked     889 non-null    object 
dtypes: float64(2), int64(5), object(5)
memory usage: 83.7+ KB