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,576
test_merged['PromoInterval'].value_counts()
No
5
72
EDA
count_values
6,511,492
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"]
7
A
2,577
test_merged['StateHoliday']=test_merged['StateHoliday'].map({'0':0,'a':1}) test_merged['StateHoliday']=test_merged['StateHoliday'].astype(int) test_merged['StoreType']=test_merged['StoreType'].map({'a':0,'b':1,'c':2,'d':3}) test_merged['StoreType']=test_merged['StoreType'].astype(int) test_merged['Assortment']=test_m...
No
5
20
Data_Transform
categorify
6,511,492
1
A
0
0
0
0
0
8
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"]
7
A
2,578
test_merged1=test_merged.drop('Id',1)
No
5
10
Data_Transform
drop_column
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,579
test_merged1.head()
No
5
41
Debug
show_table
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,580
X_train.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,581
test_merged1.shape
No
5
58
Debug
show_shape
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,582
y_pred=dt.predict(test_merged1[X_train.columns])
No
5
48
Model_Evaluation
predict_on_test
6,511,492
1
A
0
0
0
0
0
1
ok
3
3
[{"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": "Unit Testing...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"]
7
A
2,583
y_pred
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,584
y_pred_exp=np.exp(y_pred)-1
No
5
55
Data_Export
prepare_output
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,585
submission_pred=pd.DataFrame(test_merged['Id'],columns=['Id'])
No
5
12
Data_Transform
create_dataframe
6,511,492
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"]
7
A
2,586
submission_pred['Sales']=y_pred_exp
No
3
12
Data_Transform
create_dataframe
6,511,492
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"]
7
A
2,587
submission_pred['Id']=np.arange(1,len(submission_pred)+1)
No
3
12
Data_Transform
create_dataframe
6,511,492
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"]
7
A
2,588
submission_pred
No
5
41
Debug
show_table
6,511,492
1
A
0
0
0
1
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,589
# Credit: kaggle.com def ToWeight(y): w = np.zeros(y.shape, dtype=float) ind = y != 0 w[ind] = 1./(y[ind]**2) return w def rmspe(y, yhat): w = ToWeight(y) rmspe = np.sqrt(np.mean( w * (y - yhat)**2 )) return rmspe rmse_val=np.sqrt(mean_squared_error(y_val_exp,y_pred_val_exp)) rmspe_val=rms...
No
5
49
Model_Evaluation
compute_test_metric
6,511,492
1
A
1
2
0
0
10
12
ok
4
3
[{"detector": "framework_specific", "framework": "NumPy", "name": "Missing Axis Specification", "fix": "Specify axis in array operations.", "benefits": "Improves performance and avoids unexpected behaviour.", "location": "Line 17"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Che...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Column Selection Checker", "Missing function docstring"]
7
C
2,590
from sklearn.model_selection import GridSearchCV params={'max_depth':list(range(5,20))} base_model=DecisionTreeRegressor() cv_model=GridSearchCV(base_model,param_grid=params,return_train_score=True).fit(X_train,y_train)
No
5
6
Hyperparam_Tuning
train_on_grid
6,511,492
1
A
0
0
0
0
0
4
ok
5
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Verbose Mode Checker", "fix": "Enable verbose mode for long training processes.", "benefits": "Provides better insights into model training progress.", "location": "Line 11"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
7
A
2,591
df_cv_results=pd.DataFrame(cv_model.cv_results_).sort_values(by='mean_test_score',ascending=False)
No
5
12
Data_Transform
create_dataframe
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,592
df_cv_results.set_index('param_max_depth')['mean_test_score'].plot.line() df_cv_results.set_index('param_max_depth')['mean_train_score'].plot.line() plt.show()
No
4
3
Hyperparam_Tuning
find_best_model_class
6,511,492
1
A
0
0
0
0
0
3
ok
3
3
[{"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
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}]
["Unit Testing Checker"]
7
B
2,593
df_cv_results=pd.DataFrame(cv_model.cv_results_).sort_values(by='mean_test_score',ascending=False)[['param_max_depth','mean_test_score','mean_train_score']] df_cv_results
No
5
55
Data_Export
prepare_output
6,511,492
1
A
0
0
0
1
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,594
def get_rmspe_score(model,input_values,y_actual): y_predicted=model.predict(input_values) y_actual=np.exp(y_actual)-1 y_predicted=np.exp(y_predicted)-1 score=rmspe(y_actual,y_predicted) return score params={'max_depth':list(range(5,8))} base_model=DecisionTreeRegressor() cv_model=GridSearchCV(base_...
No
4
3
Hyperparam_Tuning
find_best_model_class
6,511,492
1
A
0
1
0
0
0
10
ok
9
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Verbose Mode Checker", "fix": "Enable verbose mode for long training processes.", "benefits": "Provides better insights into model training progress.", "location": "Line 17"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
B
No random seed setting detected=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"]
7
B
2,595
from sklearn.ensemble import AdaBoostRegressor model_ada=AdaBoostRegressor(n_estimators=5).fit(X_train,y_train)
No
5
7
Model_Train
train_model
6,511,492
3
C
2
0
0
0
10
2
ok
4
4
[{"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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
7
C
2,596
model_ada.estimators_[0]
No
4
7
Model_Train
train_model
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,597
features=X_train.columns draw_tree(model_ada.estimators_[0],features)
No
5
79
Visualization
model_coefficients
6,511,492
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,598
import xgboost as xgb
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,599
dtrain=xgb.DMatrix(X_train,y_train) dvalidate=xgb.DMatrix(X_val,y_val) param={'max_depth':5,'eta':1,'ojective':'reg:linear'} model_xg=xgb.train(param,dtrain,200) pred_y=model_xg.predict(dvalidate) val_y_inv=np.exp(y_val)-1 pred_y_inv=np.exp(pred_y)-1 rmspe_val=rmspe(val_y_inv,pred_y_inv) print(rmspe_val)
No
3
7
Model_Train
train_model
6,511,492
1
A
0
0
0
0
0
9
ok
5
5
[{"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", "Unit Testing Checker"]
7
B
2,600
test_merged=test_merged.drop(['Id','Customers'],1)
No
3
6
Hyperparam_Tuning
train_on_grid
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,601
y_pred_xg=model_xg.predict(xgb.DMatrix(test_merged[X_train.columns]))
No
5
48
Model_Evaluation
predict_on_test
6,511,492
1
A
0
0
0
0
0
1
ok
3
3
[{"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": "Unit Testing...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"]
7
A
2,602
y_pred_xg_exp=np.exp(y_pred_xg)-1
No
5
55
Data_Export
prepare_output
6,511,492
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,603
y_pred_xg_exp
No
5
41
Debug
show_table
6,511,492
1
A
0
0
0
1
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
2,604
submission_predicted1 = pd.DataFrame({'Id': test['Id'], 'Sales': y_pred_xg_exp}) testop0=(test[test['Open']==0]['Open']).index Sales1=[] for i in range(41088): if i in testop0: Sales1.append(0) else: Sales1.append(submission_predicted1['Sales'][i]) submission_predicted1['Sales']=Sales1 print(sub...
No
4
25
Data_Export
save_to_csv
6,511,492
1
A
0
2
4
0
0
11
ok
5
4
[{"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": "Unit Testing...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"]
7
B
2,605
store=pd.read_csv('/kaggle/input/rossmann-store-sales/store.csv') data=pd.read_csv('/kaggle/input/rossmann-store-sales/train.csv') test=pd.read_csv('/kaggle/input/rossmann-store-sales/test.csv') submission=pd.read_csv('/kaggle/input/rossmann-store-sales/sample_submission.csv')
No
5
45
Data_Extraction
load_from_csv
6,518,412
1
A
0
0
0
0
0
4
ok
5
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."]
6
A
2,606
print(data.shape) print(store.shape) print(test.shape) print(submission.shape)
No
5
58
Debug
show_shape
6,518,412
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,607
data.dtypes # date and stateholidays as categorical columns
No
5
70
Debug
show_data_types
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,608
#lets dive into the statistical description of data data.describe(include='object') # we have 942 similar dates and 5 similar etries in state holidays
No
5
40
Debug
show_table_attributes
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,609
#we have sales and customer column in which we have to focus more on the customer segment as this will also be one of the major factor affecting the sales data.describe()[['Sales','Customers']].loc['max']
No
5
40
Debug
show_table_attributes
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,610
data.Store.nunique() data.Store.value_counts().head(20).plot.bar() data.Store.value_counts().tail(20).value_counts() data.Store.value_counts()
No
4
72
EDA
count_values
6,518,412
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,611
# lets check for the store to be open data.Open.value_counts()
No
5
72
EDA
count_values
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,612
#record of dayof week for the store data.DayOfWeek.value_counts() #record for the store data.groupby(['DayOfWeek'])[['Sales']].mean() # the first day of the week ,the sales is higher
No
3
72
EDA
count_values
6,518,412
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,613
#checking the null values data.isnull().sum() store.isnull().sum() # the store data has more null values so for furthur imputations we have to fill it test.isnull().sum() # there is some missing values in test data too
No
5
39
EDA
count_missing_values
6,518,412
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,614
# convert datetime column to date data['Date']=pd.to_datetime(data['Date'],format='%Y-%m-%d')
No
5
16
Data_Transform
data_type_conversions
6,518,412
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"]
6
A
2,615
# lets take one store and make visualisations to se the pattern store_id=data.Store.unique()[0] print(store_id) store_rows=data[data['Store']==store_id] store_rows.resample('1D',on='Date')['Sales'].sum().plot.line(figsize=(10,8)) #plotting the 1day sales for the selected store_id over past 2 years before 2015
No
5
81
Visualization
relationship
6,518,412
1
A
0
0
0
0
0
4
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,616
#carry on our analysis over the picked store store_rows[store_rows['Sales']==0] # showing the analysis of no sales for the store 1
No
5
14
Data_Transform
filter
6,518,412
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"]
6
A
2,617
test['Date']=pd.to_datetime(test['Date'],format='%Y-%m-%d') store_test_rows=test[test['Store']==store_id] store_test_rows['Date'].min(),store_test_rows['Date'].max()
No
3
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,618
store_test_rows['Open'].value_counts() # the shop will be closed(7days )means the sales will be zero for the given days #lets proceed ahead to the exploration for predictig the sales for the dates on test data
No
5
72
EDA
count_values
6,518,412
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"]
6
A
2,619
store_rows['Sales'].plot.hist() #it is slightly skewed in target column means there are certain rows where slaes data is missing
No
5
33
Visualization
distribution
6,518,412
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"]
6
A
2,620
store.head() store[store['Store']==store_id].T # we dont know what value imputaion we can do to fill the missinng values so we are takinng a single store and anlaysing the data
No
4
41
Debug
show_table
6,518,412
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,621
#missing value treatment store.isna().sum() # its obvious technically to say that the week that have zero promos so we can fill it with zero store['Promo2SinceWeek']=store['Promo2SinceWeek'].fillna(0)
No
4
17
Data_Transform
correct_missing_values
6,518,412
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,622
store['Promo2SinceYear']=store['Promo2SinceYear'].fillna(store['Promo2SinceYear'].mode().iloc[0]) #technically its wrong to say promos missed for 2 years but for current scenrio we can fill it with mode store['PromoInterval']=store['PromoInterval'].fillna(store['PromoInterval'].mode().iloc[0]) #its obvious that there...
No
5
17
Data_Transform
correct_missing_values
6,518,412
1
A
0
0
0
0
0
5
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,623
store['Promo2SinceYear'].mode() data_merged=data.merge(store,on='Store',how='left') print(data.shape) print(data_merged.shape) #just have a look over the missing value after merging the data over store data/sometimes there is missing value after the merge print(data_merged.isna().sum().sum())
No
3
32
Data_Transform
merge
6,518,412
1
A
0
0
0
0
0
5
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,624
#lets do the decision tree regresssion #Encoding #3 cat_cols,1date_col,rest are numerical data_merged.dtypes data_merged['day']=data_merged['Date'].dt.day data_merged['month']=data_merged['Date'].dt.month data_merged['year']=data_merged['Date'].dt.year # will give the day of week extracion # data_merged['dayofwee...
No
4
17
Data_Transform
correct_missing_values
6,518,412
1
A
0
0
0
0
0
4
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,625
data_merged.dtypes #stateholiday,assortment,promointerval,storetype-cat_cols data_merged['StateHoliday'].unique() data_merged['StateHoliday']=data_merged['StateHoliday'].map({'0':0,0:0,'a':1,'b':2,'c':3}) data_merged['StateHoliday']=data_merged['StateHoliday'].astype(int)
No
4
20
Data_Transform
categorify
6,518,412
1
A
0
0
0
0
0
4
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,626
#check the assortment columns for missing value imputation data_merged['Assortment'].unique()
No
5
57
Debug
show_unique_values
6,518,412
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"]
6
A
2,627
#data_merged.dtypes #stateholiday,assortment,promointerval,storetype-cat_cols data_merged['Assortment'].unique() data_merged['Assortment']=data_merged['Assortment'].map({'a':1,'b':2,'c':3}) data_merged['Assortment']=data_merged['Assortment'].astype(int)
No
3
20
Data_Transform
categorify
6,518,412
2
B
1
0
0
0
5
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"]
6
B
2,628
map_promo={'Jan,Apr,Jul,Oct':1,'Feb,May,Aug,Nov':2,'Mar,Jun,Sept,Dec':3} data_merged['PromoInterval']=data_merged['PromoInterval'].map(map_promo)
No
5
20
Data_Transform
categorify
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,629
#trainn and test validate features=data_merged.columns.drop(['Sales','Date']) from sklearn.model_selection import train_test_split train_x,validate_x,train_y,validate_y=train_test_split(data_merged[features],np.log(data_merged['Sales']+1),test_size=0.2,random_state=1) train_x.shape,validate_x.shape,train_y.shape,vali...
No
4
21
Data_Transform
prepare_x_and_y
6,518,412
1
A
0
0
0
0
0
4
ok
2
2
[{"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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
6
B
2,630
#apply decision tree regressor from sklearn.tree import DecisionTreeRegressor model_dt=DecisionTreeRegressor(max_depth=11,random_state=1).fit(train_x,train_y) validate_y_pred=model_dt.predict(validate_x)
No
4
7
Model_Train
train_model
6,518,412
2
B
1
0
0
0
5
3
ok
8
7
[{"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, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["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"]
6
B
2,631
validate_y_pred=model_dt.predict(validate_x) from sklearn.metrics import mean_squared_error def ToWeight(y): w = np.zeros(y.shape, dtype=float) ind = y != 0 w[ind] = 1./(y[ind]**2) return w def rmspe(y, yhat): w = ToWeight(y) rmspe= np.sqrt(np.mean( w * (y - yhat)**2 )) return rmspe vali...
No
4
28
Model_Train
compute_train_metric
6,518,412
1
A
1
2
0
0
10
16
ok
6
5
[{"detector": "framework_specific", "framework": "NumPy", "name": "Missing Axis Specification", "fix": "Specify axis in array operations.", "benefits": "Improves performance and avoids unexpected behaviour.", "location": "Line 19"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Che...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Column Selection Checker", "Exception Handling Checker", "Missing function docstring", "Unit Testing Checker"]
6
C
2,634
pd.Series(model_dt.feature_importances_,index=features)
No
5
79
Visualization
model_coefficients
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,635
#checking the most important feature for test data from the merged data import matplotlib.pyplot as plt plt.figure(figsize=(10,5)) yvalues=model_dt.feature_importances_ xvalues=features plt.bar(xvalues,yvalues) plt.xticks(rotation=90,color='red') plt.show()
No
5
79
Visualization
model_coefficients
6,518,412
1
A
0
0
0
0
0
7
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,636
#to check the importance of each column over the merged data on sales (target variable) data_merged.corr().loc['Sales'].sort_values(ascending=False)
No
4
80
Visualization
heatmap
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,637
#we rae finding the average number of customers as it will help in addition of customers column in test data will help in prediction of customers store_avg_cust=data.groupby(['Store'])[['Customers']].mean().reset_index().astype(int)
No
3
60
Data_Transform
groupby
6,518,412
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,638
test1=test.merge(store_avg_cust,on='Store',how='left') test1.shape,test.shape
No
4
32
Data_Transform
merge
6,518,412
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
2,639
test_merged['Open']=test_merged['Open'].fillna(1) test_merged['Date']=pd.to_datetime(test_merged['Date'],format='%Y-%m-%d') test_merged['day']=test_merged['Date'].dt.day test_merged['month']=test_merged['Date'].dt.month test_merged['year']=test_merged['Date'].dt.year test_merged['StateHoliday']=test_merged['StateHoli...
Yes
4
16
Data_Transform
data_type_conversions
6,518,412
1
A
0
0
0
0
0
8
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,640
test_merged['Assortment']=test_merged['Assortment'].map({'a':1,'b':2,'c':3}) test_merged['Assortment']=test_merged['Assortment'].astype(int) test_merged['StoreType']=test_merged['StoreType'].map({'a':1,'b':2,'c':3,'d':4}) test_merged['StoreType']=test_merged['StoreType'].astype(int) map_promo={'Jan,Apr,Jul,Oct':1,'Feb,...
No
4
20
Data_Transform
categorify
6,518,412
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,641
test_pred=model_dt.predict(test_merged[features]) test_pred_inv=np.exp(test_pred)-1 submission_predicted=pd.DataFrame({'Id':test['Id'],'Sales':test_pred_inv}) submission_predicted
No
4
48
Model_Evaluation
predict_on_test
6,518,412
1
A
0
0
0
1
0
4
ok
3
3
[{"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": "Unit Testing...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"]
6
A
2,642
submission_predicted.to_csv('submission.csv',index=False)
No
5
25
Data_Export
save_to_csv
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,643
def ToWeight(y): w = np.zeros(y.shape, dtype=float) ind = y != 0 w[ind] = 1./(y[ind]**2) return w def rmspe(y, yhat): w = ToWeight(y) rmspe = np.sqrt(np.mean( w * (y - yhat)**2 )) return rmspe validate_y_inv=np.exp(validate_y)-1 validate_y_pred_inv=np.exp(validate_y_pred)-1 rmse_val=np.sqr...
No
4
28
Model_Train
compute_train_metric
6,518,412
1
A
1
2
0
0
10
14
ok
4
3
[{"detector": "framework_specific", "framework": "NumPy", "name": "Missing Axis Specification", "fix": "Specify axis in array operations.", "benefits": "Improves performance and avoids unexpected behaviour.", "location": "Line 15"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Che...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Column Selection Checker", "Missing function docstring"]
6
C
2,644
import numpy as np from sklearn.model_selection import GridSearchCV def get_rmspe_score(model,input_values,y_actual): y_predicted=model.predict(input_values) Y_actual=np.exp(y_actual)-1 y_predicted=np.exp(y_predicted)-1 score=rmspe(y_actual,y_predicted) return score parameter={'max_depth':list(...
Yes
3
6
Hyperparam_Tuning
train_on_grid
6,518,412
1
A
2
1
0
0
7
12
ok
9
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Verbose Mode Checker", "fix": "Enable verbose mode for long training processes.", "benefits": "Provides better insights into model training progress.", "location": "Line 18"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
B
No random seed setting detected=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"]
6
B
2,645
from fastai.tabular import * import os, tarfile import random import matplotlib.pyplot as plt import pandas as pd import re from datetime import * %matplotlib inline %reload_ext autoreload %autoreload 2 np.random.seed(23) np.set_printoptions(threshold=50, edgeitems=20)
No
5
23
Environment
set_options
6,606,006
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
2,646
!ls -al /kaggle/input/rossmann-time-series-data-engineering
No
5
88
Debug
list_files
6,606,006
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,647
OUTPUT = '/kaggle/working/' PATH='/kaggle/input/rossmann-time-series-data-engineering/' df = pd.read_feather(f'{PATH}df') train_df = pd.read_feather(f'{PATH}joined2') test_df = pd.read_feather(f'{PATH}joined2_test') train_df.shape, test_df.shape
No
4
44
Data_Extraction
load_from_disk
6,606,006
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,648
cat_vars = ['Store', 'DayOfWeek', 'Promo', 'StateHoliday', 'SchoolHoliday', 'Year', 'Month', 'Week', 'Day', 'Is_year_end', 'Is_year_start', 'StoreType', 'Assortment', 'Promo2', 'PromoInterval', 'State', 'Events', 'CompetitionMonthsOpen', 'Promo2Weeks', 'SchoolHoliday_bw',...
No
5
10
Data_Transform
drop_column
6,606,006
1
A
0
0
0
0
0
17
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,649
test_df['Date'].min(), test_df['Date'].max(), len(test_df)
No
5
40
Debug
show_table_attributes
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,650
cut = train_df['Date'][(train_df['Date'] == train_df['Date'][len(test_df)])].index.max() valid_idx = range(cut) ; valid_idx
No
5
14
Data_Transform
filter
6,606,006
1
A
0
0
0
1
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,651
train_df['Date'][0], train_df['Date'][cut]
No
5
41
Debug
show_table
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,652
procs=[FillMissing, Categorify, Normalize] datalist = (TabularList.from_df(df, path=OUTPUT, cat_names=cat_vars, cont_names=cont_vars, procs=procs,) .split_by_idx(valid_idx=valid_idx) .label_from_df(cols=dep_var, label_cls=FloatList, log=True) .add_test(TabularList.from_d...
No
3
13
Data_Transform
split
6,606,006
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,653
defaults.device
No
5
84
Other
not_enough_vertices
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,654
max_log_y = np.log(np.max(train_df['Sales'])*1.2) # whether it is better to have +20% max sales need to be verified y_range = torch.tensor([0, max_log_y], device=defaults.device) learn = tabular_learner(data, layers=[1000,500], ps=[0.001,0.01], emb_drop=0.04, y_range=y_range, metrics=exp_rmspe...
No
2
4
Model_Train
choose_model_class
6,606,006
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,655
learn.to_fp16
No
2
4
Model_Train
choose_model_class
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,656
learn.data.batch_size
No
5
23
Environment
set_options
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,657
import fastai fastai.__version__
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,658
learn.lr_find(end_lr=100, wd=0.3) learn.recorder.plot()
No
5
2
Hyperparam_Tuning
find_best_params
6,606,006
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,659
learn.fit_one_cycle(5, 3e-3, wd=0.3)
No
5
7
Model_Train
train_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,660
learn.save('bs512_5ep_2e-3_wd0.3')
No
5
50
Model_Train
save_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,661
learn.fit_one_cycle(5, 1e-3, wd=0.3)
No
5
7
Model_Train
train_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,662
learn.recorder.plot_losses()
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,663
learn.save('bs512_2_5ep_1e-3_wd0.3')
No
5
50
Model_Train
save_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,664
learn.fit_one_cycle(5, 3e-4, wd=0.3) learn.recorder.plot_losses()
No
4
7
Model_Train
train_model
6,606,006
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,665
learn.save('bs512_3_5ep_3e-4_wd0.3')
No
5
50
Model_Train
save_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,666
data = datalist.databunch(bs=128) learn.data = data learn.data.batch_size
No
4
23
Environment
set_options
6,606,006
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,667
learn.fit_one_cycle(5, 1e-3, wd=0.2) learn.recorder.plot_losses()
No
3
7
Model_Train
train_model
6,606,006
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,668
learn.save('bs128_5ep_1e-3_wd0.2')
No
5
50
Model_Train
save_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,669
learn.fit_one_cycle(5, 1e-3, wd=0.1) learn.recorder.plot_losses()
No
4
7
Model_Train
train_model
6,606,006
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,670
learn.fit_one_cycle(20, 1e-3, wd=0.1) learn.recorder.plot_losses()
No
4
7
Model_Train
train_model
6,606,006
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,672
learn.save('last')
No
5
50
Model_Train
save_model
6,606,006
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,673
test_preds=learn.get_preds(DatasetType.Test) test_df["Sales"]=np.exp(test_preds[0].data).numpy().T[0] test_df[["Id","Sales"]]=test_df[["Id","Sales"]].astype("int") test_df[["Id","Sales"]].to_csv("rossmann_submission.csv",index=False)
No
4
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,677
import pandas as pd from pandas import DataFrame as df import numpy as np
No
5
22
Environment
import_modules
7,004,483
1
A
0
0
0
0
0
3
ok
2
1
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 2"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Import Checker"]
5
A
2,678
path= "../input/rossmann-store-sales/"
No
5
77
Other
define_variables
7,004,483
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 2"}, {"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path de...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "Import Checker"]
5
A
2,679
store_data=pd.read_csv(path+"store.csv") train_data=pd.read_csv(path+"train.csv") test_data=pd.read_csv(path+"test.csv") store_data=store_data.fillna(-1) print(store_data.keys(),"\ ",train_data.keys()) '
No
4
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
2,680
months_dict={ "-1":0, "Jan":1, "Feb":2, "Mar":3, "Apr":4, "May":5, "Jun":6, "Jul":7, "Aug":8, "Sept":9, "Oct":10, "Nov":11, "Dec":12 } characters_dict={ "a":0, "b":1, "c":2, "d":3, "e":4, "f":5, "g":6, "h":7, "i":8, "j":9,"k":10,"l":11,"m":12,"n":13, "o":14, "p":15, "q"...
Yes
2
14
Data_Transform
filter
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
2,681
preprocessed_store_data = pre_process_store_data(store_data,months_dict,characters_dict) preprocessed_train_data, preprocessed_train_labels = pre_process_train_data(train_data) preprocessed_dataset = connect_store_data_with_train_data(preprocessed_train_data,preprocessed_store_data)
No
2
14
Data_Transform
filter
7,004,483
1
A
0
0
0
0
0
3
ok
4
4
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 2"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validat...
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"}]
["Import Checker"]
5
B