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
3,412
pred = knn.predict(test_data.drop("Id",axis=1))
Yes
4
7
Model_Train
train_model
10,550,675
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
4
A
3,413
submission = pd.DataFrame(data=pred,columns=["Cover_Type"]) submission["Id"] = test_data["Id"] submission.set_index("Id",inplace=True)
No
5
55
Data_Export
prepare_output
10,550,675
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"]
4
A
3,414
submission.to_csv("Submission.csv")
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
3,415
import numpy as np import pandas as pd import seaborn as sns from sklearn.metrics import accuracy_score,confusion_matrix,roc_curve,auc from sklearn.preprocessing import StandardScaler from xgboost import XGBClassifier from sklearn.model_selection import train_test_split
No
5
22
Environment
import_modules
10,760,317
1
A
0
0
0
0
0
7
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker"]
5
A
3,416
df_train = pd.read_csv('/kaggle/input/forest-cover-type-prediction/train.csv') df_test = pd.read_csv('/kaggle/input/forest-cover-type-prediction/test.csv')
No
5
45
Data_Extraction
load_from_csv
10,760,317
1
A
0
0
0
0
0
2
ok
4
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}, {"detector": "general_ml", "framework": "Genera...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
5
A
3,417
df_train.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
3,418
test_id =df_test['Id'] train_id = df_train ['Id']
No
5
77
Other
define_variables
10,760,317
1
A
0
0
0
0
0
2
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": "Dependent Th...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Dependent Threshold Checker"]
5
A
3,419
df_train.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
3,420
df_test.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
3,421
df_test.columns
No
5
71
Debug
show_columns
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,422
df_test.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
3,423
# From both train and test data df_train.drop(['Id'], axis = 1,inplace = True) df_test.drop(['Id'], axis = 1,inplace = True)
No
5
10
Data_Transform
drop_column
10,760,317
1
A
0
0
0
0
0
2
ok
4
3
[{"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": "...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "InPlace Checker"]
5
B
3,424
sns.heatmap(df_train.isnull())
No
5
80
Visualization
heatmap
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,425
sns.heatmap(df_test.isnull())
No
5
80
Visualization
heatmap
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,426
corrmat = df_train.corr() sns.heatmap(corrmat,vmax = 0.8,square = True)
No
5
80
Visualization
heatmap
10,760,317
1
A
0
0
0
0
0
2
ok
2
2
[{"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"}]
["Dependent Threshold Checker"]
5
B
3,427
data_corr.head()
No
5
41
Debug
show_table
10,760,317
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker"]
5
A
3,428
plt.figure(figsize=(15,10)) pd.crosstab(train.Wilderness_Area, train.Cover_Type).plot.barh(figsize=(15,15),stacked = True)
No
5
33
Visualization
distribution
8,895,321
1
A
0
0
0
0
0
2
ok
1
1
[{"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": ""}]
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
[]
8
B
3,429
plt.figure(figsize=(15,10)) pd.crosstab(train.soil_type, train.Cover_Type).plot.barh(figsize=(15,15),stacked = True)
No
5
33
Visualization
distribution
8,895,321
1
A
0
0
0
0
0
2
ok
1
1
[{"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": ""}]
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
[]
8
B
3,430
plt.subplots(figsize=(10,10)) corr = df_viz.corr() ax = sns.heatmap( corr, vmin=-1, vmax=1, center=0, cmap=sns.diverging_palette(20, 220, n=200), square=True ) ax.set_xticklabels( ax.get_xticklabels(), rotation=45, horizontalalignment='right' );
No
5
80
Visualization
heatmap
8,895,321
1
A
0
0
0
0
0
13
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
3,431
def add_feature(data): data['Ele_minus_VDtHyd'] = data.Elevation-data.Vertical_Distance_To_Hydrology data['Ele_plus_VDtHyd'] = data.Elevation+data.Vertical_Distance_To_Hydrology data['Distanse_to_Hydrolody'] = (data['Horizontal_Distance_To_Hydrology']**2+data['Vertical_Distance_To_Hydrology']**2)**0.5 ...
No
5
8
Data_Transform
feature_engineering
null
1
A
0
1
0
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,432
train = add_feature(train) test = add_feature(test)
No
4
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
3,433
X_train = train.drop(['Id','Cover_Type','soil_type','Wilderness_Area'], axis = 1) y_train = train.Cover_Type X_test = test.drop(['Id'], axis = 1)
No
5
21
Data_Transform
prepare_x_and_y
8,895,321
1
A
0
0
0
0
0
3
ok
1
1
[{"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": ""}]
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
[]
8
B
3,434
%%time lr_pipe = Pipeline( steps = [ ('scaler', MinMaxScaler()), ('classifier', LogisticRegression(solver='lbfgs', n_jobs=-1)) ] ) lr_param_grid = { 'classifier__C': [1, 10, 100,1000], } np.random.seed(1) grid_search = GridSearchCV(lr_pipe, lr_param_grid, cv=5, refit='True') grid_search...
No
4
6
Hyperparam_Tuning
train_on_grid
8,895,321
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
8
null
3,435
%%time rf_pipe = Pipeline( steps = [ ('classifier', RandomForestClassifier(n_estimators=500)) ] ) param_grid = { 'classifier__min_samples_leaf': [2, 3, 4, 8], 'classifier__max_depth': [30, 32, 34], } np.random.seed(1) rf_grid_search = GridSearchCV(rf_pipe, param_grid, cv=5, refit='True', n_j...
No
5
6
Hyperparam_Tuning
train_on_grid
8,895,321
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
8
null
3,436
rf_model = rf_grid_search.best_estimator_ cv_score = cross_val_score(rf_model, X_train, y_train, cv = 5) print(cv_score) print("Accuracy: %0.2f (+/- %0.2f)" % (cv_score.mean(), cv_score.std() * 2))
Yes
5
1
Hyperparam_Tuning
find_best_score
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,437
rf = rf_grid_search.best_estimator_.steps[0][1]
No
3
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
3,438
feat_imp = rf.feature_importances_ feat_imp_df = pd.DataFrame({ 'feature':X_train.columns, 'feat_imp':feat_imp }) feat_imp_df.sort_values(by='feat_imp', ascending=False).head(10)
Yes
5
79
Visualization
model_coefficients
null
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,439
sorted_feat_imp_df = feat_imp_df.sort_values(by='feat_imp', ascending=True) plt.figure(figsize=[6,6]) plt.barh(sorted_feat_imp_df.feature[-20:], sorted_feat_imp_df.feat_imp[-20:]) plt.show()
No
5
79
Visualization
model_coefficients
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,440
%%time xgd_pipe = Pipeline( steps = [ ('classifier', XGBClassifier(n_estimators=50, subsample=0.5)) ] ) param_grid = { 'classifier__learning_rate' : [0.45], 'classifier__min_samples_split' : [8, 16, 32], 'classifier__min_samples_leaf' : [2], 'classifier__max_depth': [15] } np.ra...
Yes
4
6
Hyperparam_Tuning
train_on_grid
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,441
xgd_model = xgd_grid_search.best_estimator_ cv_score = cross_val_score(xgd_model, X_train, y_train, cv = 5) print(cv_score) print("Accuracy: %0.2f (+/- %0.2f)" % (cv_score.mean(), cv_score.std() * 2))
Yes
5
28
Model_Train
compute_train_metric
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,442
final_model = xgd_grid_search.best_estimator_.steps[0][1]
No
5
3
Hyperparam_Tuning
find_best_model_class
8,895,321
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Chain Indexing", "fix": "Use single indexing or .loc[], .iloc[] methods.", "benefits": "Enhances code readability and prevents performance issues.", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Chain Indexing"]
8
A
3,443
final_model.fit(X_train, y_train) y_pred = final_model.predict(X_test)
Yes
4
7
Model_Train
train_model
8,895,321
1
A
0
0
0
0
0
2
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, 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", "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
3,444
print(len(test.Id))
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
3,445
print(len(y_pred))
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
3,446
from collections import Counter Counter(y_pred)
Yes
5
72
EDA
count_values
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,447
submission_sample.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
3,448
submission = pd.DataFrame({'Id': test.Id, 'Cover_Type': y_pred}) submission.head()
Yes
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,449
test_data['Slope'].plot(kind='hist')
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
3,450
train_data['Elevation'].plot(kind='hist')
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
3,451
X=train_data.drop(labels=['Id','Cover_Type'],axis=1)
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
3,452
y=train_data['Cover_Type']
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,453
X_train,X_val,y_train,y_val=train_test_split(X,y,random_state=40)
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
3,454
rfc=RandomForestClassifier(n_estimators=70) rfc.fit(X_train,y_train)
Yes
5
7
Model_Train
train_model
12,086,305
1
A
0
0
0
0
0
2
ok
6
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, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
B
3,455
Submission=pd.DataFrame(data=predict,columns=['Cover_type']) Submission.head()
Yes
5
55
Data_Export
prepare_output
12,086,305
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,456
Submission['Id']=test_data['Id'] Submission.set_index('Id',inplace=True) Submission.head()
Yes
5
55
Data_Export
prepare_output
12,086,305
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"]
4
A
3,458
dataset_train = pd.read_csv('/kaggle/input/forest-cover-type-prediction/train.csv') dataset_test = pd.read_csv('/kaggle/input/forest-cover-type-prediction/test.csv') dataset_train_copy = dataset_train.copy() dataset_test_copy = dataset_test.copy()
No
4
45
Data_Extraction
load_from_csv
13,246,053
1
A
0
0
0
0
0
4
ok
4
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": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
4
B
3,459
dataset_train.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
3,460
dataset_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
3,461
dataset_train_copy.drop('Id', axis=1, inplace=True) dataset_test_copy.drop('Id', axis=1, inplace=True)
No
5
10
Data_Transform
drop_column
13,246,053
1
A
0
0
0
0
0
2
ok
3
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 5"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["InPlace Checker"]
4
B
3,462
X = dataset_train_copy.iloc[:, :-1].values y = dataset_train_copy.iloc[:, -1].values X_submission = dataset_test_copy.iloc[:, :].values
No
3
21
Data_Transform
prepare_x_and_y
13,246,053
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,463
from sklearn.preprocessing import StandardScaler sc = StandardScaler() X_train = sc.fit_transform(X) X_submission = sc.transform(X_submission) y_train = y
Yes
5
18
Data_Transform
normalization
13,246,053
1
A
0
0
0
0
0
5
ok
9
8
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Pipeline Checker", "fix": "Use Pipelines for all scikit-learn estimators.", "benefits": "Prevents data leakage and ensures correct model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross V...
D
Cross Validation Checker=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline 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"]
4
D
3,464
from sklearn.ensemble import RandomForestClassifier classifier = RandomForestClassifier(n_estimators = 30, criterion = 'entropy', random_state = 0) classifier.fit(X_train, y_train)
Yes
5
7
Model_Train
train_model
13,246,053
2
B
1
0
0
0
5
3
ok
6
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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
B
3,465
y_submission = classifier.predict(X_submission) dataset_submission = pd.DataFrame({'Id':dataset_test.iloc[:,0], 'Cover_Type': y_submission}) dataset_submission.set_index('Id', inplace=True)
Yes
5
55
Data_Export
prepare_output
13,246,053
1
A
0
0
0
0
0
3
ok
3
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}, {"detector": "framework_specific", "framework":...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker"]
4
A
3,466
dataset_submission
No
5
41
Debug
show_table
13,246,053
1
A
0
0
0
1
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,467
dataset_submission.to_csv('Submission.csv')
No
5
25
Data_Export
save_to_csv
13,246,053
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,468
train_df=pd.read_csv('/kaggle/input/forest-cover-type-prediction/train.csv') train_df.head()
Yes
4
45
Data_Extraction
load_from_csv
13,676,351
1
A
0
0
0
0
0
2
ok
2
2
[{"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": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Hardcoded file path"]
4
B
3,469
test_df=pd.read_csv('/kaggle/input/forest-cover-type-prediction/test.csv') test_df.head()
Yes
4
45
Data_Extraction
load_from_csv
13,676,351
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/forest-cover-type-prediction/test.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 5"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
4
A
3,470
train_df.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
3,471
test_df.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
3,472
test_id=test_df['Id']
No
3
14
Data_Transform
filter
13,676,351
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"]
4
A
3,473
train_df.drop(['Id'],axis=1,inplace=True) test_df.drop(['Id'],axis=1,inplace=True)
No
5
10
Data_Transform
drop_column
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,474
X=train_df.drop(['Cover_Type'],axis=1) y=train_df['Cover_Type']
No
5
21
Data_Transform
prepare_x_and_y
13,676,351
1
A
0
0
0
0
0
2
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"]
4
B
3,475
X_train,X_test,y_train,y_test=train_test_split(X,y,random_state=40)
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
3,476
from sklearn.neighbors import KNeighborsClassifier KNN=KNeighborsClassifier(n_neighbors=6) KNN.fit(X_train,y_train)
Yes
5
7
Model_Train
train_model
13,676,351
1
A
0
0
0
0
0
3
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"]
4
B
3,477
KNN.score(X_test,y_test)
No
5
49
Model_Evaluation
compute_test_metric
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,478
pred=KNN.predict(test_df)
No
5
48
Model_Evaluation
predict_on_test
13,676,351
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
4
A
3,479
result=pd.DataFrame(data=pred,columns=['Cover_Type'])
No
5
12
Data_Transform
create_dataframe
13,676,351
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,480
result['Id']=test_id result.set_index('Id',inplace=True) result.head()
Yes
3
55
Data_Export
prepare_output
13,676,351
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"]
4
A
3,481
result.to_csv('Submission.csv')
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
3,482
# This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e....
Yes
5
88
Debug
list_files
null
1
A
0
2
3
0
0
7
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 12"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
0
A
3,483
test_data = pd.read_csv('/kaggle/input/forest-cover-type-prediction/test.csv') test_data.head()
Yes
4
45
Data_Extraction
load_from_csv
14,012,397
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/forest-cover-type-prediction/test.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 5"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
4
A
3,484
X = train_data.drop(labels = ['Id','Cover_Type'],axis = 1) Y = train_data['Cover_Type']
No
5
21
Data_Transform
prepare_x_and_y
14,012,397
1
A
0
0
0
0
0
2
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"]
4
B
3,485
X_train,X_val,Y_train,Y_val = train_test_split(X,Y,random_state = 40)
No
5
13
Data_Transform
split
14,012,397
1
A
0
0
0
0
0
1
ok
1
1
[{"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": ""}]
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
[]
4
B
3,486
print(X_train.shape,Y_train.shape) print(X_val.shape,Y_val.shape)
No
5
58
Debug
show_shape
14,012,397
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,487
rfc=RandomForestClassifier(n_estimators=70) rfc.fit(X_train,Y_train)
Yes
5
7
Model_Train
train_model
14,012,397
1
A
0
0
0
0
0
2
ok
6
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, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
B
3,488
rfc.score(X_val,Y_val)
No
5
49
Model_Evaluation
compute_test_metric
14,012,397
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}]
A
no applicable ML-specific findings
[]
["Unit Testing Checker"]
4
A
3,489
Submission['Id']=test_data['Id'] Submission.set_index('Id',inplace=True)
No
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,490
Submission.to_csv('Submission_first_time.csv')
No
5
25
Data_Export
save_to_csv
14,012,397
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,491
train_data.columns
No
5
71
Debug
show_columns
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,492
KNN = KNeighborsClassifier(n_neighbors = 11, n_jobs = -1) KNN.fit(X_train,y_train)
Yes
5
7
Model_Train
train_model
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,493
KNN.score(X_val,y_val)
No
5
49
Model_Evaluation
compute_test_metric
14,114,937
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}]
A
no applicable ML-specific findings
[]
["Unit Testing Checker"]
4
A
3,494
predict=KNN.predict(test_data.drop(labels=['Id'],axis=1))
No
5
48
Model_Evaluation
predict_on_test
14,114,937
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
4
A
3,495
# This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e....
No
5
88
Debug
list_files
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
3,496
Submission['Id']=test_data['Id'] Submission.set_index('Id',inplace=True)
No
5
55
Data_Export
prepare_output
14,668,756
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
3,497
import numpy as np import pandas as pd from sklearn import cross_validation, grid_search, linear_model, metrics, pipeline, preprocessing
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
3,498
def rmsle(y, y_): log1 = np.nan_to_num(np.array([np.log(v + 1) for v in y])) log2 = np.nan_to_num(np.array([np.log(v + 1) for v in y_])) calc = (log1 - log2) ** 2 return np.sqrt(np.mean(calc))
No
5
84
Other
not_enough_vertices
null
1
A
0
1
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,499
data = pd.read_csv("../input/train.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
3,500
data.head(3)
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
3,501
data.isnull().values.any()
No
4
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
3,502
data.datetime = data.datetime.apply(pd.to_datetime) data['month'] = data.datetime.apply(lambda x : x.month) data['hour'] = data.datetime.apply(lambda x : x.hour) data.head()
No
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,503
train_data = data.iloc[:-1000, :] test_data = data.iloc[-1000:, :] print(data.shape, train_data.shape, test_data.shape)
Yes
4
13
Data_Transform
split
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,504
train_labels = train_data['count'].values train_data = train_data.drop(['datetime', 'count', 'casual', 'registered'], axis = 1) test_labels = test_data['count'].values test_data = test_data.drop(['datetime', 'count', 'casual', 'registered'], axis = 1)
No
4
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,505
binary_data_columns = ['holiday', 'workingday'] binary_data_indices = np.array([(column in binary_data_columns) for column in train_data.columns], dtype = bool) categorical_data_columns = ['season', 'weather', 'month'] categorical_data_indices = np.array([(column in categorical_data_columns) for column in train_data....
No
4
37
EDA
count_data_types
null
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,506
transformer_list = [ #binary ('binary_variables_processing', preprocessing.FunctionTransformer(lambda data: data[:, binary_data_indices])), #numeric ('numeric_variables_processing', pipeline.Pipeline(steps = [ ('selecting', pr...
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,507
regressor = linear_model.Lasso(max_iter = 2000)
No
5
4
Model_Train
choose_model_class
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,508
estimator = pipeline.Pipeline(steps = [ ('feature_processing', pipeline.FeatureUnion(transformer_list=transformer_list)), ('model_fitting', regressor) ] ) estimator.fit(train_data, train_labels) predicted = estimator.predict(test_data) print("RMSLE: ", rmsle(test_labels, predicted)) print("MAE: ", ...
Yes
4
49
Model_Evaluation
compute_test_metric
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,509
parameters_grid = { 'model_fitting__alpha' : [0.1, 1, 2, 3, 4, 10, 30] }
No
5
5
Hyperparam_Tuning
define_search_space
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,510
rmsle_scorer = metrics.make_scorer(rmsle, greater_is_better=False) grid_cv = grid_search.GridSearchCV(estimator, parameters_grid, scoring = rmsle_scorer, cv = 4) grid_cv.fit(train_data, train_labels) predicted = grid_cv.best_estimator_.predict(test_data) print("RMSLE: ", rmsle(test_labels, predicted)) #print("MAE: ",...
No
5
2
Hyperparam_Tuning
find_best_params
null
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,511
estimator.get_params().keys()
No
5
79
Visualization
model_coefficients
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,512
from sklearn.ensemble import RandomForestRegressor regressor = RandomForestRegressor(random_state = 0, max_depth = 20, n_estimators = 150) estimator = pipeline.Pipeline(steps = [ ('feature_processing', pipeline.FeatureUnion(transformer_list = transformer_list)), ('model_fitting', regressor) ] ) esti...
Yes
4
49
Model_Evaluation
compute_test_metric
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null