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
6,403
import time import datetime import matplotlib.pyplot as plt %matplotlib inline
No
5
23
Environment
set_options
244,995
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
9
null
6,404
trainData = pd.read_csv('../input/train.csv', low_memory=False) trainData
No
5
45
Data_Extraction
load_from_csv
244,995
1
A
0
0
0
1
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/train.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 10"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
9
A
6,405
supply = pd.read_csv('../input/store.csv') supply.set_index('Store', inplace=True) supply
No
5
45
Data_Extraction
load_from_csv
244,995
1
A
0
0
0
1
0
3
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/store.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 10"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
9
A
6,406
trainData
No
5
41
Debug
show_table
244,995
1
A
0
0
0
1
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
6,407
#: 2 . customers, sales<br>from sklearn.tree import DecisionTreeRegressor<br>from sklearn.ensemble import RandomForestRegressor<br>from sklearn.linear_model import LinearRegression<br>from sklearn.model_selection import GridSearchCV<br>from sklearn.model_selection import RandomizedSearchCV<br>from sklearn.mo...
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,408
X_train, customers_train, sales_train = trainData.drop(['Sales', 'Customers'], axis=1).values, trainData['Customers'].values, trainData['Sales'].values
No
5
21
Data_Transform
prepare_x_and_y
244,995
1
A
0
0
0
0
0
1
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"]
9
B
6,409
X1_train = np.concatenate((X_train, np.reshape(customers_train, (customers_train.shape[0], 1))), axis=1)
No
5
11
Data_Transform
concatenate
244,995
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
6,410
forest1 = RandomForestRegressor() forest2 = RandomForestRegressor() forest1.fit(X_train, customers_train) forest2.fit(X1_train, sales_train)
Yes
3
7
Model_Train
train_model
244,995
1
A
0
0
0
0
0
4
ok
13
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, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting 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"]
9
B
6,411
# <br>testData = pd.read_csv('../input/test.csv')<br>
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,412
testData['UnixTime'] = testData['Date'].map(toUnixTime) testData.drop('Date', axis=1, inplace=True)
Yes
3
8
Data_Transform
feature_engineering
244,995
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 11"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker"...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "InPlace Checker"]
9
A
6,413
testData.StateHoliday.replace({'a': 1, 'b': 2, 'c': 3, '0': 0}, inplace=True) unixTime = testData['UnixTime'].values testData['UnixTime'] = (unixTime - np.mean(unixTime))/np.std(unixTime)
No
4
18
Data_Transform
normalization
244,995
1
A
0
0
0
0
0
3
ok
3
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 12"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "f...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Column Selection Checker", "InPlace Checker"]
9
C
6,414
testData
No
5
41
Debug
show_table
244,995
1
A
0
0
0
1
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
6,415
nanToMedian(testData) X_test = testData.drop('Id', axis=1).values
Yes
3
10
Data_Transform
drop_column
244,995
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
6,416
customers_test = forest1.predict(X_test) X1_test = np.concatenate((X_test, np.reshape(customers_test, (customers_test.shape[0], 1))), axis=1) sales_predicted = forest2.predict(X1_test)
Yes
3
32
Data_Transform
merge
244,995
1
A
0
0
0
0
0
3
ok
5
4
[{"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...
B
No random seed setting detected=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"]
9
B
6,417
Result = pd.DataFrame(testData.Id) Result['Sales'] = sales_predicted Result.set_index('Id') Result.to_csv('./result.csv', index=False)
No
5
25
Data_Export
save_to_csv
244,995
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": "general_ml", "framework": "General ML", "name": "Hardcoded file path d...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Hardcoded file path"]
9
A
6,418
import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline
No
5
23
Environment
set_options
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
6,419
df_store = pd.read_csv('../input/store.csv', index_col=None)
No
5
45
Data_Extraction
load_from_csv
245,807
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/store.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
3
A
6,420
df_store.info()
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
6,421
df_train = pd.read_csv('../input/train.csv', index_col=None, low_memory=False)
No
5
45
Data_Extraction
load_from_csv
245,807
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/train.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
3
A
6,422
y_hat_R = R_model.predict(X_test) print(eval_rmspe(y_hat_R, y_mytest))
Yes
4
48
Model_Evaluation
predict_on_test
242,073
1
A
0
0
0
0
0
2
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"]
6
A
6,423
print(df_train.shape) df_train.head()
Yes
3
58
Debug
show_shape
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,424
#, <br>from sklearn.ensemble import RandomForestRegressor
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,425
df_train.info()
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
6,426
df_train.replace({'StateHoliday': {0: '0'}}, inplace=True) df_train.StateHoliday.unique()
Yes
3
57
Debug
show_unique_values
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,427
df_train.DayOfWeek = df_train.DayOfWeek.astype(str) # for dictvectorizer
No
5
16
Data_Transform
data_type_conversions
245,807
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"}]
[]
3
B
6,428
# <br>X_train_full, y_train_full = df_data.drop('Sales', axis=1).values, df_data['Sales'].values
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,429
X_test_full = df_test.drop('Id', axis=1).values
Yes
4
10
Data_Transform
drop_column
242,073
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
6
A
6,430
# , <br>forest = RandomForestRegressor(n_jobs=1, n_estimators=150, max_features=7, max_depth=100)<br>forest.fit(X_train_full, y_train_full)
Yes
4
4
Model_Train
choose_model_class
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,431
y_hat_full = forest.predict(X_test_full)
No
5
48
Model_Evaluation
predict_on_test
242,073
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"]
6
A
6,432
submission = submission.append(pd.Series(y_hat_full, index=store_ids))<br>submission = pd.DataFrame({ "Id": submission.index, "Sales": submission.values})<br>submission.to_csv(\'submission.csv\', index=False)
Yes
3
12
Data_Transform
create_dataframe
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,433
df = df_train[df_train.Open != 0].merge(df_store, on='Store').fillna(1) df.drop(['Store', 'Date', 'Customers'], axis=1, inplace=True)
Yes
3
17
Data_Transform
correct_missing_values
245,807
1
A
0
0
0
0
0
2
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": "general_ml", "framework": "General ML", "name...
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"}]
[]
3
B
6,434
df.shape, df.columns
Yes
3
58
Debug
show_shape
245,807
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,435
y_train = df.Sales.values
No
5
21
Data_Transform
prepare_x_and_y
245,807
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,436
print(X_train.shape, y_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
6,437
from sklearn.ensemble import RandomForestRegressor rgr = RandomForestRegressor(n_estimators=25, verbose=True, n_jobs=8) rgr.fit(X_train, y_train) print(rgr.score(X_train, y_train))
Yes
3
4
Model_Train
choose_model_class
245,807
2
B
2
0
0
0
10
4
ok
6
6
[{"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", "Unit Testing Checker", "Verbose Mode Checker"]
3
B
6,438
df_test = pd.read_csv('../input/test.csv', index_col=None)
No
5
45
Data_Extraction
load_from_csv
245,807
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/test.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
3
A
6,439
print(df_test.shape) df_test.head()
Yes
3
58
Debug
show_shape
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,440
features_to_use = ["bathrooms", "bedrooms", "latitude", "longitude", "price"]
No
5
77
Other
define_variables
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,441
df_test.replace({'StateHoliday': {0: '0'}}, inplace=True) df_test.StateHoliday.unique()
Yes
3
57
Debug
show_unique_values
245,807
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,442
df_pred = df_test[df_test.Open != 0].merge(df_store, on='Store').fillna(1) df_pred.drop(['Id', 'Store', 'Date'], axis=1, inplace=True)
Yes
3
17
Data_Transform
correct_missing_values
245,807
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,443
df_pred.shape
No
5
58
Debug
show_shape
245,807
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,444
X_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
6,445
rgr.predict(X_test)[:10]
No
5
48
Model_Evaluation
predict_on_test
245,807
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"]
3
A
6,446
df_test.loc[df_test.Open != 0,'Sales'] = rgr.predict(X_test) df_test.loc[df_test.Open == 0, 'Sales'] = 0
No
5
48
Model_Evaluation
predict_on_test
245,807
1
A
0
0
0
0
0
2
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"]
3
A
6,447
out = pd.DataFrame({<br> "Id": df_test.Id,<br> "Sales": df_test.Sales.values<br>})<br>out.to_csv(\'submission.csv\', index=False)
No
5
25
Data_Export
save_to_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,448
from mlbox.preprocessing import * from mlbox.optimisation import * from mlbox.prediction import *
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,449
paths = ["../input/train.json", "../input/test.json"] target_name = "interest_level"
No
5
77
Other
define_variables
415,588
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,450
rd = Reader() df = rd.train_test_split(paths, target_name)
No
5
13
Data_Transform
split
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,451
df["train"].head()
No
5
41
Debug
show_table
415,588
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,452
# This Python 3 environment comes with many helpful analytics libraries installed<br># It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python<br># For example, here\'s several helpful packages to load in <br><br>import os<br><br>import h2o<br>from h2o.estimators.random_forest import H2...
Yes
4
22
Environment
import_modules
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,453
import numpy as np import pandas as pd
No
5
22
Environment
import_modules
504,569
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,454
brats = pd.read_csv("../input/child_wishlist_v2.csv", header=None, index_col=0).as_matrix() gifts = pd.read_csv("../input/gift_goodkids_v2.csv", header=None, index_col=0).as_matrix()
No
5
45
Data_Extraction
load_from_csv
504,569
1
A
0
0
0
0
0
2
ok
2
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/child_wishlist_v2.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 3"}, {"detector": "general_ml", "framework": "General ML", "...
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
2
A
6,455
TRIPS_COUNT = 5_001 TWINS_COUNT = 40_000 TWINS_START = TRIPS_COUNT TWINS_END = TWINS_START + TWINS_COUNT GIFTS_LIMIT = 1_000 BRAT_PREF_COUNT = brats.shape[1] GIFT_PREF_COUNT = gifts.shape[1]
No
5
77
Other
define_variables
504,569
1
A
0
0
0
0
0
7
ok
3
1
[{"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 5001", "fix": "Not specified", "benefits": "Not specified", "location": "Line 3"}, {"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 40000", "fix": "Not specified", "benefits": "Not specified", "lo...
A
no applicable ML-specific findings
[]
["Magic number"]
2
A
6,456
submit = pd.read_csv("save/"+target_name+"_predictions.csv")[["high", "medium", "low"]] submit["listing_id"] = df["test"].listing_id.astype(int).values submit.to_csv("mlbox.csv", index=False)
Yes
3
45
Data_Extraction
load_from_csv
415,588
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,457
print("Quantity of Gifts:") pd.Series(gift_cnt).value_counts()
No
5
72
EDA
count_values
504,569
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,458
import os, operator, math import pandas as pd import numpy as np import datetime as dt from tqdm import tqdm import matplotlib.pyplot as plt from scipy.optimize import linear_sum_assignment from collections import defaultdict, Counter
Yes
3
22
Environment
import_modules
515,984
1
A
0
0
0
0
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,459
scores = pd.DataFrame(rows) scores.head()
Yes
4
12
Data_Transform
create_dataframe
504,569
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,460
submission = pd.DataFrame({ "ChildId": range(len(brats)), "GiftId": assigned })
No
5
12
Data_Transform
create_dataframe
504,569
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,461
child_data = pd.read_csv('../input/santa-gift-matching/child_wishlist_v2.csv', header=None).drop(0, 1).values gift_data = pd.read_csv('../input/santa-gift-matching/gift_goodkids_v2.csv', header=None).drop(0, 1).values n_children = 1000000 n_gift_type = 1000 n_gift_qu...
Yes
3
77
Other
define_variables
515,984
1
A
0
0
0
0
0
11
ok
7
2
[{"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 1000000", "fix": "Not specified", "benefits": "Not specified", "location": "Line 8"}, {"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 1000", "fix": "Not specified", "benefits": "Not specified", "...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "Magic number"]
2
A
6,462
submission.to_csv("greedy_v2.csv", index=False)
No
5
25
Data_Export
save_to_csv
504,569
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,463
import os, cv2, re, random import numpy as np import pandas as pd from keras.preprocessing.image import ImageDataGenerator from keras.preprocessing.image import img_to_array, load_img from keras import layers, models, optimizers from keras import backend as K from sklearn.model_selection import train_test_split
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
6,464
initial_sub = '../input/max-flow-with-min-cost-v2-0-9267/subm_0.926447635166.csv' subm = pd.read_csv(initial_sub) subm['gift_rank'] = subm.groupby('GiftId').rank() - 1 subm['gift_id'] = subm['GiftId'] * 1000 + subm['gift_rank'] subm['gift_id'] = subm['gift_id'].astype(np.int64) current_gift_ids = subm['gift_id'].values
Yes
3
8
Data_Transform
feature_engineering
515,984
1
A
0
0
0
0
0
6
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": "general_ml", "framework": "General ML", "name": "Hardcoded file path d...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Hardcoded file path"]
2
A
6,465
import os, cv2, itertools import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline
No
5
23
Environment
set_options
595,311
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
2
null
6,466
train_images_dogs_cats.sort(key=natural_keys) train_images_dogs_cats = train_images_dogs_cats[0:1300] + train_images_dogs_cats[12500:13800] test_images_dogs_cats.sort(key=natural_keys)
Yes
4
9
Data_Transform
sort_values
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,467
def prepare_data(list_of_images):<br> """<br> Returns two arrays: <br> x is an array of resized images<br> y is an array of labels<br> """<br> x = [] # images as arrays<br> y = [] # labels<br> <br> for image in list_of_images:<br> x.append(cv2.resize(cv2.imread(image), (img_wid...
No
5
21
Data_Transform
prepare_x_and_y
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,468
from sklearn.linear_model import LogisticRegressionCV from sklearn.metrics import confusion_matrix clf = LogisticRegressionCV() X_train_lr, y_train_lr = X_train.T, y_train.T.ravel() clf.fit(X_train_lr, y_train_lr)
Yes
3
22
Environment
import_modules
595,311
1
A
1
0
0
0
5
5
ok
7
7
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Scaler Missing Checker", "fix": "Apply scaling before scaling-sensitive operations.", "benefits": "Improves model performance and accuracy.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation...
C
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low, Scaler Missing Checker=medium
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Scaler Missing Checker", "severity": "medium"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
2
C
6,469
X, Y = prepare_data(train_images_dogs_cats) print(K.image_data_format())
Yes
4
21
Data_Transform
prepare_x_and_y
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,470
# First split the data in two sets, 80% for training, 20% for Val/Test) X_train, X_val, Y_train, Y_val = train_test_split(X,Y, test_size=0.2, random_state=1)
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
6,471
submission = pd.DataFrame(np.hstack([test_idx, clf.predict_proba(X_test_lr)]), columns=['id', 'cat', 'dog'])
No
5
12
Data_Transform
create_dataframe
595,311
1
A
0
0
0
0
0
1
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"]
2
A
6,472
nb_train_samples = len(X_train) nb_validation_samples = len(X_val) batch_size = 16
No
5
77
Other
define_variables
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,473
model = models.Sequential() model.add(layers.Conv2D(32, (3, 3), input_shape=(img_width, img_height, 3))) model.add(layers.Activation('relu')) model.add(layers.MaxPooling2D(pool_size=(2, 2))) model.add(layers.Conv2D(32, (3, 3))) model.add(layers.Activation('relu')) model.add(layers.MaxPooling2D(pool_size=(2, 2))) mod...
No
5
4
Model_Train
choose_model_class
null
1
A
0
0
0
0
0
20
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,474
submission = submission.drop([\'cat\'], axis=1)<br>submission = submission.rename(index=str, columns={"dog": "label"})<br>submission[\'id\'] = submission[\'id\'].astype(int)<br>submission.sort_values(\'id\', inplace=True)
Yes
3
61
Data_Transform
rename_columns
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,475
submission.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
6,476
submission.to_csv('STahamtan_Dog_vs_Cat_Submission.csv', index=False)
No
5
25
Data_Export
save_to_csv
595,311
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
2
A
6,477
# This Python 3 environment comes with many helpful analytics libraries installed<br># It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python<br># For example, here\'s several helpful packages to load in <br><br>import numpy as np # linear algebra<br>import pandas as pd # data processi...
No
5
88
Debug
list_files
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,478
train = pd.read_json("../input/train.json") test = pd.read_json("../input/test.json")
No
5
44
Data_Extraction
load_from_disk
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,479
test.info()
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
6,480
history = model.fit_generator( train_generator, steps_per_epoch=nb_train_samples // batch_size, epochs=30, validation_data=validation_generator, validation_steps=nb_validation_samples // batch_size )
No
4
7
Model_Train
train_model
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,481
model.save_weights('model_wieghts.h5') model.save('model_keras.h5')
Yes
4
50
Model_Train
save_model
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,482
train['interest_level'].value_counts()
No
5
72
EDA
count_values
685,472
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"}]
[]
3
B
6,483
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'bathrooms\', shade=True)<br>facet.add_legend()<br>plt.show()
No
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,484
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'bathrooms\', shade=True)<br>facet.set(xlim=(0,2))<br>facet.add_legend()<br>plt.show()
No
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,485
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'bathrooms\', shade=True)<br>facet.set(xlim=(2,6))<br>facet.add_legend()<br>plt.show()
No
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,486
for dataset in train_test: dataset.loc[ dataset['bathrooms'] <= 2, 'bathrooms'] = 2, dataset.loc[(dataset['bathrooms'] > 2) & (dataset['bathrooms'] <= 4), 'bathrooms'] = 1, dataset.loc[ dataset['bathrooms'] > 4, 'bathrooms'] = 0
No
5
8
Data_Transform
feature_engineering
685,472
1
A
0
1
1
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,487
facet = sns.FacetGrid(train, hue = "interest_level", aspect=4)<br>facet.map(sns.kdeplot, \'bedrooms\', shade=True)<br>facet.add_legend()<br>plt.show()
No
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,488
for dataset in train_test: dataset.loc[ dataset['bedrooms'] <= 2, 'bedrooms'] = 0, dataset.loc[(dataset['bedrooms'] > 2) & (dataset['bedrooms'] <= 4), 'bedrooms'] = 1, dataset.loc[ dataset['bedrooms'] > 4, 'bedrooms'] = 2
No
5
8
Data_Transform
feature_engineering
685,472
1
A
0
1
1
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,489
counter = range(1, len(test_images_dogs_cats) + 1)<br>solution = pd.DataFrame({"id": counter, "label":list(prediction_probabilities)})<br>cols = [\'label\']<br><br>for col in cols:<br> solution[col] = solution[col].map(lambda x: str(x).lstrip(\'[\').rstrip(\']\')).astype(float)<br><br>solution.to_csv("dogsVScats.csv...
Yes
3
12
Data_Transform
create_dataframe
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,490
import pandas as pd import numpy as np from sklearn import ensemble, preprocessing
No
5
22
Environment
import_modules
716,075
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,491
# Load dataset train = pd.read_csv('../input/train.csv') test = pd.read_csv('../input/test.csv') sample = pd.read_csv('../input/sampleSubmission.csv') weather = pd.read_csv('../input/weather.csv')
No
5
45
Data_Extraction
load_from_csv
716,075
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."]
3
A
6,492
sum(train['building_id']=='0')
No
5
72
EDA
count_values
685,472
1
A
0
0
0
1
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,493
# Not using codesum for this benchmark weather = weather.drop('CodeSum', axis=1)
No
5
10
Data_Transform
drop_column
716,075
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,494
train["created"] = pd.to_datetime(train["created"]) train["month_created"] = train["created"].dt.month
Yes
3
16
Data_Transform
data_type_conversions
685,472
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,495
train["month_created"]
No
5
41
Debug
show_table
685,472
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
6,496
train['month_created'].value_counts()
No
5
72
EDA
count_values
685,472
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"}]
[]
3
B
6,497
# Split station 1 and 2 and join horizontally weather_stn1 = weather[weather['Station']==1] weather_stn2 = weather[weather['Station']==2] weather_stn1 = weather_stn1.drop('Station', axis=1) weather_stn2 = weather_stn2.drop('Station', axis=1) weather = weather_stn1.merge(weather_stn2, on='Date')
Yes
3
14
Data_Transform
filter
716,075
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"]
3
A
6,498
def bar_chart(feature):<br> low = train[train['interest_level']=='low'][feature].value_counts() # survived <br> medium = train[train['interest_level']=='medium'][feature].value_counts()<br> high = train[train['interest_level']=='high'][feature].value_counts()<br> df = pd.DataFrame([low, medium, high])<b...
Yes
3
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,499
train["created"] = pd.to_datetime(train["created"])<br>train["date_created"] = train["created"].dt.date<br>cnt_srs = train[\'date_created\'].value_counts()<br><br>plt.figure(figsize=(12,4))<br>ax = plt.subplot(111)<br>ax.bar(cnt_srs.index, cnt_srs.values, alpha=0.8)<br>ax.xaxis_date()<br>plt.xticks(rotation=\'vertical\...
Yes
4
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
6,500
train['month'] = train.Date.apply(create_month) train['day'] = train.Date.apply(create_day) test['month'] = test.Date.apply(create_month) test['day'] = test.Date.apply(create_day)
No
5
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
6,501
# Add integer latitude/longitude columns train['Lat_int'] = train.Latitude.apply(int) train['Long_int'] = train.Longitude.apply(int) test['Lat_int'] = test.Latitude.apply(int) test['Long_int'] = test.Longitude.apply(int)
No
5
16
Data_Transform
data_type_conversions
716,075
1
A
0
0
0
0
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": "Cross Valida...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker"]
3
B
6,502
train['day_of_week'] = train['created'].dt.weekday
No
5
8
Data_Transform
feature_engineering
685,472
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A