id
int64
0
7.95k
code_block
stringlengths
1
52.9k
too_long
stringclasses
2 values
marks
int64
1
5
graph_vertex_id
float64
1
88
graph_vertex_class
stringclasses
12 values
graph_vertex_subclass
stringclasses
70 values
kernel_id
float64
25.8k
14.7M
⌀
sqale_rating
float64
1
4
maintainability_rating
stringclasses
4 values
code_smells
int64
0
36
complexity
float64
0
15
⌀
cognitive_complexity
int64
0
33
bugs
int64
0
7
sqale_index
int64
0
125
ncloc
float64
0
101
⌀
mlscent_analysis_status
stringclasses
3 values
mlscent_smell_count
int64
0
31
mlscent_unique_smell_count
int64
0
12
mlscent_findings_json
stringlengths
2
7.76k
mlscent_ml_rating
stringclasses
5 values
mlscent_ml_rating_basis
stringclasses
52 values
mlscent_ml_findings_json
stringclasses
50 values
mlscent_ignored_findings_json
stringclasses
199 values
context_line_count
int64
0
33
combined_rating
stringclasses
5 values
2,157
df_train[df_train.Customers>7000]
No
5
14
Data_Transform
filter
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,158
g = sns.distplot(data['Sales']) g.set_title("Data Distribution") '
No
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,159
zero_sales = data[data['Sales']==0].copy() data = data[data['Sales']!=0].drop('Open', 1)
No
4
10
Data_Transform
drop_column
2,095,107
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
6
A
2,160
fig, ax = plt.subplots (1,4, figsize=(20,4)) sns.barplot(['Size'], [len(zero_sales)], ax=ax[0]) sns.countplot('DayOfWeek', data=zero_sales, ax=ax[1]) sns.countplot('Open', data=zero_sales, ax=ax[2]) sns.countplot('Promo', data=zero_sales, ax=ax[3]) plt.tight_layout()
No
5
75
Visualization
time_series
2,095,107
1
A
0
0
0
0
0
6
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
6
A
2,161
plt.figure(figsize=(8,8)) sns.heatmap(data .corr(), cmap='coolwarm')
No
5
80
Visualization
heatmap
2,095,107
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,162
data.fillna(0, inplace=True) test.fillna(1, inplace=True)
No
5
17
Data_Transform
correct_missing_values
2,095,107
1
A
0
0
0
0
0
2
ok
2
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 7"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "...
A
no applicable ML-specific findings
[]
["InPlace Checker"]
6
A
2,163
# Combining train and test data # Decomposing date features data['part'] = 'train' test['part'] = 'test' all_data = pd.concat([data, test], 0)[data.columns.tolist()+['Id']] all_data['Date'] = pd.to_datetime(all_data['Date']) all_data['Month'] = all_data['Date'].dt.month all_data['Year'] = all_data['Date'].dt.year all_...
No
5
8
Data_Transform
feature_engineering
2,095,107
1
A
0
0
0
0
0
10
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 19"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker"...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "InPlace Checker"]
6
A
2,164
all_data.head()
No
5
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,165
tmp = all_data[all_data['part']=='train'] sns.regplot('CompetitionOpen', 'Sales', data=tmp, ci=None)
No
5
33
Visualization
distribution
2,095,107
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
6
A
2,166
b"all_data['PromoOpen'] = 12 * (all_data.Year - all_data.Promo2SinceYear) + \\\n (all_data.WeekOfYear - all_data.Promo2SinceWeek) / 4.0\nall_data['PromoOpen'] = all_data['PromoOpen'].apply(lambda x: x if x > 0 else 0)"
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,167
tmp = all_data[all_data['part']=='train'] sns.regplot('PromoOpen', 'Sales', data=tmp, ci=None)
No
5
33
Visualization
distribution
2,095,107
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
6
A
2,168
df_store[pd.isnull(df_store.CompetitionDistance)] #rows with missing values for Competition Distance, only 3 rows with null which makes sense since 99.73% is filled
No
2
14
Data_Transform
filter
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,169
df_store_check_distribution=df_store.drop(df_store[pd.isnull(df_store.CompetitionDistance)].index) fig, axes = plt.subplots(1, 2, figsize=(17,3.5)) axes[0].boxplot(df_store_check_distribution.CompetitionDistance, showmeans=True,vert=False,) axes[0].set_xlim(0,max(df_store_check_distribution.CompetitionDistance+1000)) a...
No
2
33
Visualization
distribution
null
1
A
0
0
0
1
0
9
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,170
df_store['CompetitionDistance'].fillna(df_store['CompetitionDistance'].median(), inplace = True)
No
5
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,171
df_store.CompetitionOpenSinceMonth.fillna(0, inplace = True) df_store.CompetitionOpenSinceYear.fillna(0,inplace=True)
No
5
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,173
df_store.Promo2SinceWeek.fillna(0,inplace=True) df_store.Promo2SinceYear.fillna(0,inplace=True) df_store.PromoInterval.fillna(0,inplace=True)
No
5
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,174
#Left-join the train to the store dataset since .Why? #Because you want to make sure you have all events even if some of them don't have their store information ( which shouldn't happen) df_train_store = pd.merge(df_train, df_store, how = 'left', on = 'Store') df_train_store.head() print ("The Train_Store dataset has ...
No
4
32
Data_Transform
merge
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,175
df_train_store['SalesperCustomer']=df_train_store['Sales']/df_train_store['Customers']
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,176
df_train_store.head()
No
5
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,177
fig, axes = plt.subplots(2, 3,figsize=(17,10) ) palette = itertools.cycle(sns.color_palette(n_colors=4)) plt.subplots_adjust(hspace = 0.28) #axes[1].df_train_store.groupby(by="StoreType").count().Store.plot(kind='bar') axes[0,0].bar(df_store.groupby(by="StoreType").count().Store.index,df_store.groupby(by="StoreType").c...
No
3
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,178
StoretypeXAssortment = sns.countplot(x="StoreType",hue="Assortment",order=["a","b","c","d"], data=df_store,palette=sns.color_palette("Set2", n_colors=3)).set_title("Number of Different Assortments per Store Type") df_store.groupby(by=["StoreType","Assortment"]).Assortment.count()
No
2
33
Visualization
distribution
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,179
df_train_store['Month']=df_train_store.Date.dt.month df_train_store['Year']=df_train_store.Date.dt.year
No
3
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,180
sns.factorplot(data = df_train_store, x ="Month", y = "Sales", col = 'Promo', # per store type in cols hue = 'Promo2', row = "Year" ,sharex=False) '
No
4
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,181
sns.factorplot(data = df_train_store, x ="Month", y = "SalesperCustomer", col = 'Promo', # per store type in cols hue = 'Promo2', row = "Year" ,sharex=False)'
No
2
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,182
sns.factorplot(data = df_train_store, x ="DayOfWeek", y = "Sales", hue='Promo' ,sharex=False)'
No
2
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,183
#33 Stores are opened on Sundays print ("Number of Stores opened on Sundays:{}" .format(df_train_store[(df_train_store.Open == 1) & (df_train_store.DayOfWeek == 7)]['Store'].unique().shape[0]))'
No
3
54
EDA
count_unique_values
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,184
df_train_store['CompetitionDist_Cat']=pd.cut(df_train_store['CompetitionDistance'], 5)
No
4
13
Data_Transform
split
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,185
df_train_store.groupby(by="CompetitionDist_Cat").Sales.mean(),df_train_store.groupby(by="CompetitionDist_Cat").Customers.mean()
No
5
60
Data_Transform
groupby
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,186
del df_train_store["CompetitionDist_Cat"]
No
5
10
Data_Transform
drop_column
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,187
df_train_store['Day']=df_train_store.Date.dt.day
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,188
del df_train_store["Date"]
No
5
10
Data_Transform
drop_column
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,189
df_train_store['StoreType'].isnull().any(),df_train_store['Assortment'].isnull().any(),df_train_store['StateHoliday'].isnull().any() #No Null values we can proceed with the transformation
No
2
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,190
df_train_store["StoreType"].value_counts(),df_train_store["Assortment"].value_counts(),df_train_store["StateHoliday"].value_counts()
No
4
54
EDA
count_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,191
df_train_store['StateHoliday'] = df_train_store['StateHoliday'].astype('category') df_train_store['Assortment'] = df_train_store['Assortment'].astype('category') df_train_store['StoreType'] = df_train_store['StoreType'].astype('category') df_train_store['PromoInterval']= df_train_store['PromoInterval'].astype('category...
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,192
df_train_store['StateHoliday_cat'] = df_train_store['StateHoliday'].cat.codes df_train_store['Assortment_cat'] = df_train_store['Assortment'].cat.codes df_train_store['StoreType_cat'] = df_train_store['StoreType'].cat.codes df_train_store['PromoInterval_cat'] = df_train_store['PromoInterval'].cat.codes
No
3
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,193
df_train_store['StateHoliday_cat'] = df_train_store['StateHoliday_cat'].astype('float') df_train_store['Assortment_cat'] = df_train_store['Assortment_cat'].astype('float') df_train_store['StoreType_cat'] = df_train_store['StoreType_cat'].astype('float') df_train_store['PromoInterval_cat'] = df_train_store['PromoInterva...
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,194
from argparse import Namespace #There are 1115 stores. Select a small sample to do experimentation on. Select all for full training. num_sample_stores=1115 #The test set is 47 days. Normally use the last 47 days of the training data for validation. Se to 0 and use all data for traing when submitting to kaggle valid_...
No
5
59
Model_Train
init_hyperparams
2,568,883
1
A
0
0
0
0
0
17
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,195
from pathlib import Path from datetime import datetime, timedelta import numpy as np import pandas as pd from fastai import * from fastai.tabular import * #display results import plotly import plotly.plotly as py import plotly.graph_objs as go import cufflinks as cf
No
5
22
Environment
import_modules
2,568,883
1
A
0
0
0
0
0
10
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,196
plotly.offline.init_notebook_mode(connected=False) cf.go_offline() %matplotlib inline %reload_ext autoreload %autoreload 2 pd.set_option('display.max_columns', 0) pd.set_option('display.max_rows', 500)
No
5
23
Environment
set_options
2,568,883
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
2
null
2,197
!ls ../input/
No
5
88
Debug
list_files
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,198
path=Path("../input/rossmann-data-engineering/") traindf=pd.read_feather(path/"train.feather") testdf=pd.read_feather(path/"test.feather")
No
5
44
Data_Extraction
load_from_disk
2,568,883
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/rossmann-data-engineering/. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 3"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
2
A
2,199
best_type= data.sort_values('revenue', ascending=False) plt.figure(figsize=(13,12)) sns.barplot(x=best_type['Type'], y=best_type['revenue'])
No
4
9
Data_Transform
sort_values
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,200
data
No
5
41
Debug
show_table
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,201
#Select size validation set based on valid_days variable from datetime import datetime, timedelta valid_idx=traindata[traindata.Date>=(traindata.Date.max()- timedelta(days=valid_days))].index.tolist()
No
4
8
Data_Transform
feature_engineering
2,568,883
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,202
#Convert datetime columns to int64 for traning datecols=traindata.select_dtypes(include="datetime").columns.tolist() traindata[datecols]=traindata[datecols].astype("int64") testdf[datecols]=testdf[datecols].astype("int64")
No
5
16
Data_Transform
data_type_conversions
2,568,883
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,203
procs = [FillMissing, Categorify, Normalize] dep_var = 'Sales' #cont_names,cat_names= cont_cat_split(sample_train,dep_var="Sales") cont_names=[ 'CompetitionDistance', 'Week', 'Day', 'Dayofyear', 'Elapsed', 'ratio-sales-customer', 'ratio-saturday-week', 'ratio-sunday-week', 'ratio-promo-nopromo', 'Promo_thiswe...
No
3
21
Data_Transform
prepare_x_and_y
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,204
max_log_y = np.log(np.max(traindata['Sales']))#*1.2 y_range = torch.tensor([0, max_log_y], device=defaults.device)
No
4
21
Data_Transform
prepare_x_and_y
2,568,883
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "NumPy", "name": "Missing Axis Specification", "fix": "Specify axis in array operations.", "benefits": "Improves performance and avoids unexpected behaviour.", "location": "Line 3"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Chec...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Column Selection Checker"]
2
C
2,205
databunch = (TabularList.from_df(traindata, path="", cat_names=cat_names, cont_names=cont_names, procs=procs,) .split_by_idx(valid_idx) .label_from_df(cols=dep_var, label_cls=FloatList, log=True) .add_test(TabularList.from_df(testdf, path=path, cat_names=cat_names, cont_n...
No
4
13
Data_Transform
split
2,568,883
1
A
0
0
0
0
0
6
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,206
learn = tabular_learner(databunch, layers=[s.l1,s.l2], ps=[s.ps1,s.ps2], emb_drop=s.emb_drop, y_range=y_range, metrics=exp_rmspe)
No
5
4
Model_Train
choose_model_class
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,207
learn.lr_find()
No
5
2
Hyperparam_Tuning
find_best_params
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,208
learn.recorder.plot()
No
5
35
Visualization
learning_history
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,209
learn.fit_one_cycle(s.l1epoch, s.lrate, wd=s.wd)
No
5
7
Model_Train
train_model
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,210
learn.fit_one_cycle(s.l2epoch, s.lrate/s.lrate_ratio, wd=s.wd)
No
5
7
Model_Train
train_model
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,211
learn.fit_one_cycle(s.l3epoch, s.lrate/(s.lrate_ratio*s.lrate_ratio), wd=s.wd)
No
5
7
Model_Train
train_model
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,212
valid_preds=learn.get_preds(DatasetType.Valid) traindata["SalesPreds"]=pd.Series(index=traindata.iloc[valid_idx].index,data=np.exp(valid_preds[0].numpy().T[0]))
No
4
48
Model_Evaluation
predict_on_test
2,568,883
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,213
#Define error function def rmspe_metric(act,pred): return np.sqrt(np.mean(((act-pred)/act)**2))
No
5
84
Other
not_enough_vertices
null
1
A
0
1
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,214
rmspe_metric(traindata.Sales,traindata.SalesPreds)
No
5
28
Model_Train
compute_train_metric
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,215
#Sort stores by how much error store_rmspe=traindata.groupby(["Store"]).apply(lambda x:rmspe_metric(x.Sales,x.SalesPreds)).sort_values(ascending=False)
No
5
28
Model_Train
compute_train_metric
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,216
store_rmspe.iplot(kind="histogram")
No
5
33
Visualization
distribution
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,217
store_rmspe[:10]
No
5
41
Debug
show_table
2,568,883
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,218
t=traindata.set_index("Date")
No
5
61
Data_Transform
rename_columns
2,568,883
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,219
#Stores with most error for store in store_rmspe.index[:4].tolist(): t[t.Store==store][["Sales","SalesPreds"]].iplot(kind="bar",barmode="overlay",title="Store {}".format(store))
No
5
33
Visualization
distribution
null
1
A
0
1
1
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,220
#Stores with least error for store in store_rmspe.index[-4:].tolist(): t[t.Store==store][["Sales","SalesPreds"]].iplot(kind="bar",barmode="overlay",title="Store {}".format(store))
No
5
33
Visualization
distribution
null
1
A
0
1
1
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,221
test_preds=learn.get_preds(DatasetType.Test) testdf["Sales"]=np.exp(test_preds[0].data).numpy().T[0] testdf[["Id","Sales"]]=testdf[["Id","Sales"]].astype("int") testdf[["Id","Sales"]].to_csv("rossmann_submission.csv",index=False)
No
3
25
Data_Export
save_to_csv
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,223
import pandas as pd import numpy as np import matplotlib.pyplot as plt from xgboost import XGBRegressor
No
5
22
Environment
import_modules
3,237,641
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,224
train_data = pd.read_csv("../input/train.csv",low_memory= False) test_data = pd.read_csv("../input/test.csv",low_memory= False) store_data = pd.read_csv("../input/store.csv",low_memory= False) test_copy = test_data
No
5
45
Data_Extraction
load_from_csv
3,237,641
1
A
0
0
0
0
0
4
ok
3
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/train.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 3"}, {"detector": "general_ml", "framework": "General ML", "name": "Hard...
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
2
A
2,225
print("Shape of Train data :", train_data.shape) print("Shape of Test data :", test_data.shape) print("Shape of Store data :", store_data.shape)
No
5
58
Debug
show_shape
3,237,641
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,226
train_data.head()
No
5
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,227
store_data.head(100)
No
5
41
Debug
show_table
3,237,641
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,228
train_data.isnull().sum()
No
5
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,229
test_data.isnull().sum()
No
5
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,230
store_data.isnull().sum().sort_values(ascending = False)
No
5
39
EDA
count_missing_values
3,237,641
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,231
store_data['Promo2SinceWeek'].unique()
No
5
57
Debug
show_unique_values
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,232
train_data['Store'].unique()
No
5
57
Debug
show_unique_values
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,233
train_data['DayOfWeek'].unique()
No
5
57
Debug
show_unique_values
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,234
train_data['Open'].unique()
No
5
57
Debug
show_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,235
train_data['StateHoliday'].unique()
No
5
57
Debug
show_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,236
train_data['Promo'].unique()
No
5
57
Debug
show_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,237
store_data['CompetitionOpenSinceMonth'].unique()
No
5
57
Debug
show_unique_values
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,238
print(sum(train_data["Open"] == 0)) print(sum(train_data["Open"] == 1))
No
5
72
EDA
count_values
3,237,641
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,239
print(sum(test_data["Open"] == 0)) print(sum(test_data["Open"] == 1))
No
5
72
EDA
count_values
3,237,641
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,240
print(sum(train_data["StateHoliday"] == 'a')) print(sum(train_data["StateHoliday"] == 'b')) print(sum(train_data["StateHoliday"] == 'c')) print(sum(train_data["StateHoliday"] == 0))'
No
5
72
EDA
count_values
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,241
plt.plot(train_data['DayOfWeek'],train_data['Customers'])
No
5
81
Visualization
relationship
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,242
train_data[['Sales','Customers','Promo','SchoolHoliday']].corr(method='pearson')
No
5
40
Debug
show_table_attributes
3,237,641
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,243
train_data['Mon'] = train_data["Date"].apply(lambda x : int(x[5:7])) train_data['Yr'] = train_data["Date"].apply(lambda x : int(x[:4])) train_data["HolidayBin"] = train_data.StateHoliday.map({"0": 0, "a": 1, "b": 1, "c": 1})'
No
4
16
Data_Transform
data_type_conversions
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,244
test_data['Mon'] = test_data["Date"].apply(lambda x : int(x[5:7])) test_data['Yr'] = test_data["Date"].apply(lambda x : int(x[:4])) test_data["HolidayBin"] = test_data.StateHoliday.map({"0": 0, "a": 1, "b": 1, "c": 1})'
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,245
train_data = train_data.merge(store_data) test_data =test_data.merge(store_data)
No
5
32
Data_Transform
merge
3,237,641
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,246
train_data.isnull().sum().sort_values(ascending= False)
No
5
39
EDA
count_missing_values
3,237,641
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,247
test_data.isnull().sum().sort_values(ascending= False)
No
5
39
EDA
count_missing_values
3,237,641
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,248
test_data[test_data['Open'].isnull()]
No
5
14
Data_Transform
filter
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,249
for i in train_data['Promo2SinceWeek'].unique() : print(i ,':', sum(train_data['Promo2SinceWeek'] == i ))
No
5
72
EDA
count_values
3,237,641
1
A
0
1
1
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,250
for i in train_data['CompetitionOpenSinceMonth'].unique() : print(i ,':', sum(train_data['CompetitionOpenSinceMonth'] == i ))
No
5
72
EDA
count_values
3,237,641
1
A
0
1
1
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,251
for i in train_data['Promo2SinceYear'].unique() : print(i ,':', sum(train_data['Promo2SinceYear'] == i ))
No
5
72
EDA
count_values
3,237,641
1
A
0
1
1
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,252
for i in train_data['CompetitionOpenSinceYear'].unique() : print(i ,':', sum(train_data['CompetitionOpenSinceYear'] == i ))
No
5
72
EDA
count_values
3,237,641
1
A
0
1
1
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,253
train_data = train_data.drop(['Customers', 'Store','Date','StateHoliday'],axis= 1 ) test_data = test_data.drop(['Date','StateHoliday','Store','Id'],axis= 1 )
No
5
10
Data_Transform
drop_column
3,237,641
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
2,254
sum(train_data['Open'] == 0)
No
5
72
EDA
count_values
3,237,641
1
A
0
0
0
1
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,255
train_data = train_data.drop(train_data[train_data['Open'] == 0].index.tolist())
No
5
10
Data_Transform
drop_column
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,256
train_data[train_data['HolidayBin'].isnull()]
No
5
14
Data_Transform
filter
3,237,641
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,257
train_data['CompetitionOpenSinceMonth'] = train_data['CompetitionOpenSinceMonth'].fillna(9.0) train_data['HolidayBin'] = train_data['HolidayBin'].fillna(0) train_data['Promo2SinceWeek'] = train_data['Promo2SinceWeek'].fillna(40.0) train_data['Promo2SinceYear'] = train_data['Promo2SinceYear'].fillna(2012.0) train_data['...
No
5
17
Data_Transform
correct_missing_values
3,237,641
1
A
0
0
0
0
0
7
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A
2,258
test_data['Open'] = test_data['Open'].fillna(1) test_data['CompetitionOpenSinceMonth'] = test_data['CompetitionOpenSinceMonth'].fillna(9.0) test_data['CompetitionDistance'] = test_data['CompetitionDistance'].fillna(train_data['CompetitionDistance'].mean()) test_data['CompetitionOpenSinceYear'] = test_data['CompetitionO...
No
4
17
Data_Transform
correct_missing_values
3,237,641
1
A
0
0
0
0
0
7
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
2
A