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
1,141
firstfatality.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
1,142
firstfatality.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,143
firstconfirmed.columns = ['Province_State','Country_Region','FirstCaseDate'] firstfatality.columns = ['Province_State','Country_Region','FirstFatalityDate']
No
5
61
Data_Transform
rename_columns
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,144
df = df.merge(firstconfirmed, left_on=['Province_State','Country_Region'],right_on=['Province_State','Country_Region'],how='left') df = df.merge(firstfatality, left_on=['Province_State','Country_Region'],right_on=['Province_State','Country_Region'],how='left')
No
5
32
Data_Transform
merge
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,145
df.head(40)
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
1,146
df_test = df_test.merge(firstconfirmed, left_on=['Province_State','Country_Region'],right_on=['Province_State','Country_Region'],how='left') df_test = df_test.merge(firstfatality, left_on=['Province_State','Country_Region'],right_on=['Province_State','Country_Region'],how='left')
No
5
32
Data_Transform
merge
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,147
df_test.head(40)
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
1,148
df['Date']=pd.to_datetime(df['Date'], infer_datetime_format=True) df['FirstCaseDate']=pd.to_datetime(df['FirstCaseDate'], infer_datetime_format=True) df['FirstFatalityDate']=pd.to_datetime(df['FirstFatalityDate'], infer_datetime_format=True)
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,149
df_test['Date']=pd.to_datetime(df_test['Date'], infer_datetime_format=True) df_test['FirstCaseDate']=pd.to_datetime(df_test['FirstCaseDate'], infer_datetime_format=True) df_test['FirstFatalityDate']=pd.to_datetime(df_test['FirstFatalityDate'], infer_datetime_format=True)
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,150
df['days_first_case']=(df['Date']-df['FirstCaseDate']).dt.days df['days_first_fatality']=(df['Date']-df['FirstFatalityDate']).dt.days
No
5
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
1,151
df['days_first_case']
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
1,152
df_test['days_first_case']=(df_test['Date']-df_test['FirstCaseDate']).dt.days df_test['days_first_fatality']=(df_test['Date']-df_test['FirstFatalityDate']).dt.days
No
5
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
1,153
df_test['days_first_case']
No
3
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,154
df['days_first_case']=np.where(df['days_first_case']<0,0,df['days_first_case'].fillna(0)) df['days_first_fatality']=np.where(df['days_first_fatality']<0,0,df['days_first_fatality'].fillna(0))
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
1,155
df_test['days_first_case']=np.where(df_test['days_first_case']<0,0,df_test['days_first_case'].fillna(0)) df_test['days_first_fatality']=np.where(df_test['days_first_fatality']<0,0,df_test['days_first_fatality'].fillna(0))
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
1,156
df.tail()
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
1,157
df[df['Country_Region']=='Brazil'].tail()
No
3
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,158
df_test[df_test['Country_Region']=='Brazil'].tail()
No
4
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,159
add_datepart(df,'Date',drop=False)
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
1,160
add_datepart(df_test,'Date',drop=False)
No
5
13
Data_Transform
split
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,161
external = pd.read_csv('/kaggle/input/covid19-week2-external-data/external_data.csv',sep=';',decimal=',')
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,162
external.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
1,163
df = df.merge(external, left_on='key',right_on='key',how='left')
No
5
32
Data_Transform
merge
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,164
df_test = df_test.merge(external, left_on='key',right_on='key',how='left')
No
5
32
Data_Transform
merge
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,165
list(df)
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
1,166
df['Confirmedlast43'] = df['ConfirmedCases'].shift(43) df['Fatalitieslast43'] = df['Fatalities'].shift(43)
No
5
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
1,167
df['is_valid'] = np.where(df['Date']<'2020-03-29', False, True)
No
5
8
Data_Transform
feature_engineering
8,682,800
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
1,168
df.groupby('is_valid').size()
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
1,169
df['ConfirmedLog'] = np.log(df['ConfirmedCases']+1) df['FatalitiesLog'] = np.log(df['Fatalities']+1)
No
5
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
1,170
cat_vars = ['Province_State','Country_Region','province_flag'] cont_vars = ['Elapsed', 'days_first_case', 'days_first_fatality', 'pop_density', 'population', 'area', 'lat_min', 'lat_max', 'lon_min', 'lon...
No
5
77
Other
define_variables
null
1
A
0
0
0
0
0
49
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,171
procs = [FillMissing, Categorify, Normalize] splits = ColSplitter('is_valid')(df)
No
2
13
Data_Transform
split
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,172
splits
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
1,174
to = TabularPandas(df, procs, cat_names=cat_vars, cont_names=cont_vars, y_names=dep_vars, y_block=RegressionBlock(), splits=splits)
No
5
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,175
to
No
5
53
Other
something_strange
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,176
cats.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,177
conts.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,178
y.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,179
dls.c
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,180
learn.load('/kaggle/input/covid19-week2-external-data/best18_2day')
No
5
30
Model_Train
load_pretrained
8,682,800
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/covid19-week2-external-data/best18_2day. 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
1,181
preds, y = learn.get_preds()
No
5
48
Model_Evaluation
predict_on_test
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,182
np.exp(preds)-1
No
5
55
Data_Export
prepare_output
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,183
np.exp(y)-1
No
5
53
Other
something_strange
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,184
raw_test_preds = learn.get_preds(dl=dl)
No
5
48
Model_Evaluation
predict_on_test
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,185
raw_test_preds[0]
No
4
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,186
raw_test_preds[1]
No
3
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,187
preds = np.exp(to_np(raw_test_preds[0]))-1
No
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,188
preds[:40]
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
1,189
df['ConfirmedCases'].head(40)
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
1,190
preds = pd.DataFrame(preds) preds.columns = ['pred_confirmed']
No
4
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,191
preds.tail()
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
1,192
df = pd.concat([df, preds], axis=1)
No
5
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,193
preds_confirmed_test = np.exp(to_np(raw_test_preds[0]))-1
No
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,194
preds_confirmed_test[:40]
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
1,195
learn.load('/kaggle/input/covid19-week2-external-data/fat_best2_2day')
No
5
30
Model_Train
load_pretrained
8,682,800
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/covid19-week2-external-data/fat_best2_2day. 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
1,196
preds
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
1,197
y
No
5
53
Other
something_strange
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,198
preds_confirmed_test = pd.DataFrame(preds_confirmed_test)
No
5
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,199
preds_confirmed_test.columns=['ConfirmedCases']
No
5
61
Data_Transform
rename_columns
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,200
preds_confirmed_test.tail()
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
1,201
preds_confirmed_test.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,202
df_test.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,203
df_test = pd.concat([df_test, preds_confirmed_test], axis=1)
No
5
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,204
df_test.tail(40)
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
1,205
df_test['pred_confirmed']=df_test['ConfirmedCases']
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
1,206
preds_fatalities_test = np.exp(to_np(raw_test_preds[0]))-1
No
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,207
preds_fatalities_test
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
1,208
preds_fatalities_test = pd.DataFrame(preds_fatalities_test)
No
5
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,209
preds_fatalities_test.columns=['Fatalities']
No
5
61
Data_Transform
rename_columns
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,210
preds_fatalities_test.tail()
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
1,211
preds_fatalities_test.shape
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,212
df_test = pd.concat([df_test, preds_fatalities_test], axis=1)
No
5
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,213
df_test[df_test['Country_Region']=='Brazil'].head(20)
No
3
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,214
sub_ex = df = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-2/submission.csv')
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,215
sub_ex.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
1,216
sub = df_test[['ForecastId','ConfirmedCases','Fatalities']]
No
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,217
sub.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
1,218
sub_ex.tail()
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
1,219
sub.tail()
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
1,220
import os, gc, pickle, copy, datetime, warnings import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import lightgbm as lgb from sklearn import metrics pd.set_option('display.max_columns', 100) warnings.filterwarnings('ignore')
No
2
22
Environment
import_modules
null
1
A
0
0
0
0
0
9
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
1,221
df_train = pd.read_csv("../input/covid19-global-forecasting-week-2/train.csv") print(df_train.shape) df_train.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,222
df_test = pd.read_csv("../input/covid19-global-forecasting-week-2/test.csv") print(df_test.shape) df_test.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,223
# concat train and test df_traintest = pd.concat([df_train, df_test]) print(df_train.shape, df_test.shape, df_traintest.shape)
No
3
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,224
# process date df_traintest['Date'] = pd.to_datetime(df_traintest['Date']) df_traintest['day'] = df_traintest['Date'].apply(lambda x: x.dayofyear).astype(np.int16) df_traintest.head()
Yes
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,225
# concat Country/Region and Province/State def func(x): try: x_new = x['Country_Region'] + "/" + x['Province_State'] except: x_new = x['Country_Region'] return x_new df_traintest['place_id'] = df_traintest.apply(lambda x: func(x), axis=1) df_traintest.head()'
No
4
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,226
df_traintest[(df_traintest['day']>=day_before_public-3) & (df_traintest['place_id']=='China/Hubei')].head()
No
3
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,227
# concat lat and long df_latlong = pd.read_csv("../input/smokingstats/df_Latlong.csv") df_latlong.head()
No
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,228
# concat Country/Region and Province/State def func(x): try: x_new = x['Country/Region'] + "/" + x['Province/State'] except: x_new = x['Country/Region'] return x_new df_latlong['place_id'] = df_latlong.apply(lambda x: func(x), axis=1) df_latlong = df_latlong[df_latlong['place_id'].d...
No
5
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,229
df_traintest = pd.merge(df_traintest, df_latlong[['place_id', 'Lat', 'Long']], on='place_id', how='left') df_traintest.head()
No
5
32
Data_Transform
merge
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,230
print(pd.isna(df_traintest['Lat']).sum()) # count Nan df_traintest[pd.isna(df_traintest['Lat'])].head()
No
3
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,231
data = pd.read_csv( '/kaggle/input/restaurant-revenue-prediction/train.csv.zip') test_data = pd.read_csv('/kaggle/input/restaurant-revenue-prediction/test.csv.zip') data.head()
No
4
45
Data_Extraction
load_from_csv
10,424,951
1
A
0
0
0
0
0
3
ok
3
2
[{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
8
A
1,232
data.describe()
No
5
40
Debug
show_table_attributes
10,424,951
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
1,233
data.dtypes
No
5
70
Debug
show_data_types
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,234
data['City Group'].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
1,235
data['City'].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
1,236
#Creating a flag for each type of restaurant data['Type_IL'] = np.where(data['Type'] == 'IL', 1, 0) data['Type_FC'] = np.where(data['Type'] == 'FC', 1, 0) data['Type_DT'] = np.where(data['Type'] == 'DT', 1, 0) #Creating a flag for 'Big Cities' data['Big_Cities'] = np.where(data['City Group'] == 'Big Cities', 1, 0) #C...
No
4
8
Data_Transform
feature_engineering
null
1
A
2
0
0
0
16
18
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,237
from sklearn import model_selection from sklearn import linear_model X = data.drop(['Id', 'revenue'], axis=1) Y = data.revenue
No
5
21
Data_Transform
prepare_x_and_y
10,424,951
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
1,238
from sklearn.linear_model import Lasso from sklearn.linear_model import Ridge from sklearn import metrics def check_rmse(X, Y, alpha): RMSE_lasso = [] RMSE_ridge = [] for i in alpha: lasso = Lasso(alpha=i) lasso.fit(X, Y) ridge = Ridge(alpha=i) ridge.fit(X, Y) ...
No
5
84
Other
not_enough_vertices
10,424,951
1
A
2
2
1
0
4
14
ok
12
8
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "Missing function docstring", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
1,239
plt.figure() plt.plot(alpha, RMSE_lasso, 'o-', color="r", label="RMSE_lasso") plt.legend(loc='best') plt.show()'
No
5
35
Visualization
learning_history
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,240
lasso = Lasso(alpha=5.5) lasso.fit(X, Y) metrics.mean_squared_error(Y, lasso.predict(X))
No
4
7
Model_Train
train_model
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,241
model = Lasso(alpha=5.5) model.fit(X, Y) test_predicted = pd.DataFrame() test_predicted['Id'] = test_data.Id test_predicted['Prediction'] = model.predict(test_data.drop('Id', axis=1)) test_predicted.to_csv('submission-lasso-5.5.csv', index=False) test_predicted.describe()
No
3
28
Model_Train
compute_train_metric
10,424,951
1
A
0
0
0
0
0
7
ok
11
8
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B