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
608
from sklearn.model_selection import GridSearchCV from xgboost import XGBRegressor gsearch = GridSearchCV(estimator=XGBRegressor(random_state=my_randome_state), param_grid = parameters, scoring='neg_root_mean_squared_error', n_jobs=4,cv=5, verbose=7) ...
No
4
6
Hyperparam_Tuning
train_on_grid
11,097,956
1
A
0
0
0
0
0
7
ok
4
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"]
4
A
609
best_n_estimators = gsearch.best_params_.get('n_estimators') best_learning_rate = gsearch.best_params_.get('learning_rate') best_max_depth = gsearch.best_params_.get('max_depth') best_max_gamma = gsearch.best_params_.get('gamma') best_max_eta = gsearch.best_params_.get('eta') best_max_reg_alpha = gsearch.best_para...
No
5
2
Hyperparam_Tuning
find_best_params
11,097,956
1
A
0
0
0
7
0
8
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
610
final_model = XGBRegressor(n_estimators=best_n_estimators, random_state=my_randome_state, learning_rate=best_learning_rate, max_depth=best_max_depth, gamma=best_max_gamma, eta=best_m...
No
4
7
Model_Train
train_model
11,097,956
1
A
0
0
0
0
0
9
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
611
preds_test = final_model.predict(normed_test_data)
No
5
48
Model_Evaluation
predict_on_test
11,097,956
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
612
# zip import zipfile with zipfile.ZipFile("/kaggle/input/restaurant-revenue-prediction/test.csv.zip") as zf: zf.extractall() with zipfile.ZipFile("/kaggle/input/restaurant-revenue-prediction/train.csv.zip") as zf: zf.extractall() '
No
3
44
Data_Extraction
load_from_disk
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
613
# df_train = pd.read_csv("train.csv") df_test = pd.read_csv("test.csv") df_submission = pd.read_csv("/kaggle/input/restaurant-revenue-prediction/sampleSubmission.csv")'
No
5
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
614
df_test
No
5
41
Debug
show_table
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
617
# corrmat = df_train.corr() # corrmat'
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
618
# y_train = df_train["revenue"] del df_train["revenue"]'
No
4
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
619
# df_all = pd.concat([df_train, df_test], axis=0) # axis=0 : '
No
5
11
Data_Transform
concatenate
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
620
# OpenDate # timestamp df_all["Open Date"] = pd.to_datetime(df_all["Open Date"]) df_all["Year"] = df_all["Open Date"].dt.year df_all["Month"] = df_all["Open Date"].dt.month df_all["Day"] = df_all["Open Date"].dt.day'
No
4
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
621
dftrain['Open Date'] = dftrain['Open Date'].apply(lambda x: pd.to_datetime(x)) dftest['Open Date'] = dftest['Open Date'].apply(lambda x: pd.to_datetime(x)) def calc_days(dtime): now_time = pd.to_datetime('2015-01-01') result = now_time - dtime return int(result.total_seconds()/3600//24) dftrain['days_since_...
No
3
8
Data_Transform
feature_engineering
6,470,191
1
A
1
1
0
0
12
8
ok
5
5
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "Missing function docstring"]
3
B
622
dftrain['revenue'] = dftrain['revenue'].astype(int)
No
5
16
Data_Transform
data_type_conversions
6,470,191
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"]
3
B
626
for col in dftrain.columns: if (dftrain[col].dtype == int) | (dftrain[col].dtype == float): if col not in ['P2','P3', 'P7','revenue']: dftrain[col] = dftrain[col].map(lambda x:np.log1p(x)) print (col) dftest[col] = dftest[col].map(lambda x: np.log1p(x))
No
5
20
Data_Transform
categorify
6,470,191
1
A
0
3
6
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": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
3
B
628
pd.get_dummies(dftrain).columns
No
5
71
Debug
show_columns
6,470,191
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
629
#TFI (tab food investments) has provided a dataset with 137 restaurants in the training set, and a test set of 100000 restaurants.. data = pd.read_csv('../input/restaurant-revenue-prediction/train.csv') test_data = pd.read_csv('../input/restaurant-revenue-prediction/test.csv')
No
5
45
Data_Extraction
load_from_csv
5,729,566
1
A
0
0
0
0
0
2
ok
3
2
[{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
10
A
630
data.describe()
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
631
data.head()
No
5
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
632
pd.get_dummies(dftest).columns[50:]
No
5
53
Other
something_strange
6,470,191
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
633
#log transforming dftrain revenue dftrain['revenue']= dftrain.revenue.apply(lambda x: np.log1p(x))
No
5
8
Data_Transform
feature_engineering
6,470,191
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"]
3
B
634
dftrain1 = pd.get_dummies(dftrain, drop_first = True) dftest1 = pd.get_dummies(dftest,drop_first = True)
No
5
20
Data_Transform
categorify
6,470,191
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
635
cat_cols = ['City', 'Open Date', 'City']
No
3
10
Data_Transform
drop_column
6,470,191
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
636
final_pred = model.predict(dftest1)
No
2
10
Data_Transform
drop_column
6,470,191
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
637
sampledf = pd.read_csv('/kaggle/input/restaurant-revenue-prediction/sampleSubmission.csv')
No
2
7
Model_Train
train_model
6,470,191
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/restaurant-revenue-prediction/sampleSubmission.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
638
sampledf.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
639
sub = pd.DataFrame()
No
5
12
Data_Transform
create_dataframe
6,470,191
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
640
sub['Id'] = sampledf.Id sub['Prediction'] = np.expm1(final_pred)
No
5
55
Data_Export
prepare_output
6,470,191
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"]
3
A
641
sub.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
642
train = pd.read_csv("../input/restaurant-revenue-prediction/train.csv.zip")
No
5
45
Data_Extraction
load_from_csv
11,611,498
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/restaurant-revenue-prediction/train.csv.zip. 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
643
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
644
train["City"].value_counts()
No
5
72
EDA
count_values
11,611,498
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"]
4
B
645
train["City"] = (train["City"]=="stanbul").astype(np.int)'
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
646
train["City Group"].value_counts()
No
5
72
EDA
count_values
11,611,498
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"]
4
B
647
train["City Group"] = l.fit_transform(train["City Group"])
No
3
16
Data_Transform
data_type_conversions
11,611,498
1
A
0
0
0
0
0
1
ok
6
6
[{"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...
D
Cross Validation Checker=low, Data Leakage Checker=high
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
D
648
train["Type"].value_counts()
No
5
72
EDA
count_values
11,611,498
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"]
4
B
649
train["Type"] = l.fit_transform(train["Type"])
No
5
20
Data_Transform
categorify
11,611,498
1
A
0
0
0
0
0
1
ok
6
6
[{"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...
D
Cross Validation Checker=low, Data Leakage Checker=high
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
4
D
650
train["year"]=0 for i in range(len(train["Open Date"])): a=train["Open Date"][i].split("/") train["year"][i]=a[2] train["month"]=0 for i in range(len(train["Open Date"])): a=train["Open Date"][i].split("/") train["month"][i]=a[0] train["day_No"]=0 for i in range(len(train["Open Date"])...
No
5
8
Data_Transform
feature_engineering
11,611,498
1
A
1
3
3
0
12
12
ok
9
5
[{"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 8"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Chain Indexin...
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"}]
["Chain Indexing", "Column Selection Checker", "Hardcoded file path"]
4
B
651
test = pd.read_csv("../input/restaurant-revenue-prediction/test.csv.zip")
No
5
45
Data_Extraction
load_from_csv
11,611,498
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/restaurant-revenue-prediction/test.csv.zip. 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
652
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
653
test["City"] = (test["City"]=="stanbul").astype(np.int) test["Type"] = l.fit_transform(test["Type"]) test["City Group"] = l.fit_transform(test["City Group"])'
No
4
16
Data_Transform
data_type_conversions
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
654
test["year"]=0 for i in range(len(test["Open Date"])): a=test["Open Date"][i].split("/") test["year"][i]=a[2] test["month"]=0 for i in range(len(test["Open Date"])): a=test["Open Date"][i].split("/") test["month"][i]=a[0] test["day_No"]=0 for i in range(len(test["Open Date"])): ...
No
5
8
Data_Transform
feature_engineering
11,611,498
1
A
1
3
3
0
12
12
ok
7
3
[{"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 8"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Chain Indexin...
A
no applicable ML-specific findings
[]
["Chain Indexing", "Column Selection Checker", "Hardcoded file path"]
4
A
655
x_train = train.drop(columns=["Id","revenue","Open Date"],axis=1) y_train = train["revenue"] x_test = test.drop(columns=["Id","Open Date"],axis=1) x_train.shape,x_test.shape,y_train.shape
No
5
21
Data_Transform
prepare_x_and_y
11,611,498
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"]
4
B
656
xtrain = s.fit_transform(x_train) x_train = pd.DataFrame(x_train,columns=x_train.columns) xtest = s.fit_transform(x_test) x_test = pd.DataFrame(x_test,columns=x_test.columns)
No
4
18
Data_Transform
normalization
11,611,498
1
A
0
0
0
0
0
4
ok
9
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...
D
Cross Validation Checker=low, Data Leakage Checker=high, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"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"]
4
D
657
x_train.shape,x_test.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
658
from xgboost import XGBRegressor model = XGBRegressor() model.fit(x_train,y_train) y_pred = model.predict(x_test)
No
1
48
Model_Evaluation
predict_on_test
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
659
s = pd.read_csv("../input/restaurant-revenue-prediction/sampleSubmission.csv")
No
5
45
Data_Extraction
load_from_csv
11,611,498
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/restaurant-revenue-prediction/sampleSubmission.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
660
s.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
661
f = pd.DataFrame(f)
No
5
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
662
f.to_csv("submission.csv",index=False)
No
5
25
Data_Export
save_to_csv
11,611,498
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
663
f.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
664
df=pd.read_csv("/kaggle/input/restaurant-revenue-prediction/train.csv.zip") df.head()
No
3
45
Data_Extraction
load_from_csv
11,656,525
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/restaurant-revenue-prediction/train.csv.zip. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
8
A
665
df.describe()
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
666
import matplotlib.pyplot as plt import seaborn as sns
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
667
df.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
668
df=df.drop('Id',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
669
df.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
670
df['Open Date']=pd.to_datetime(df['Open Date']) df
No
5
16
Data_Transform
data_type_conversions
11,656,525
1
A
0
0
0
1
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"]
8
A
671
df['month']=[x.month for x in df['Open Date']] df['year']=[x.year for x in df['Open Date']]
No
5
8
Data_Transform
feature_engineering
11,656,525
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"]
8
A
672
df
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
673
df.groupby('month')['revenue'].mean()
No
5
60
Data_Transform
groupby
11,656,525
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
674
sns.barplot('month','revenue',data=df)
No
5
33
Visualization
distribution
11,656,525
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
675
df=df.drop('Open Date',axis=1) df['Type'].value_counts() ty={'FC':0,'IL':1,'DT':2} df['Type']=df['Type'].map(ty)
No
3
8
Data_Transform
feature_engineering
11,656,525
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"]
8
A
676
df['City Group'].value_counts()
No
3
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
677
cg={'Big Cities':0,'Other':1} df['City Group']=df['City Group'].map(cg)
No
5
20
Data_Transform
categorify
11,656,525
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"]
8
A
678
df['City'].value_counts()
No
5
72
EDA
count_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
679
x=0 c={} for i in df['City'].unique(): c.update({i:x}) x=x+1
No
5
53
Other
something_strange
11,656,525
1
A
0
1
1
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"]
8
A
680
c
No
5
53
Other
something_strange
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
681
from sklearn.linear_model import LinearRegression from sklearn.tree import DecisionTreeRegressor from sklearn.ensemble import RandomForestRegressor from sklearn.neighbors import KNeighborsRegressor from xgboost import XGBRegressor
No
5
22
Environment
import_modules
11,656,525
1
A
0
0
0
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
682
from sklearn.metrics import mean_absolute_error ,mean_squared_error,r2_score
No
5
22
Environment
import_modules
11,656,525
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
683
dr=DecisionTreeRegressor() dr=dr.fit(X_train,Y_train) pred=dr.predict(X_test) s=mean_absolute_error(Y_test,pred) s1=mean_squared_error(Y_test,pred) s2=r2_score(Y_test,pred) print("The MAE with the DecisionTreeRegressor is: "+str(s)) print("The MsE with the DecisionTreeRegressor is: "+str(s1)) print("The R2_Score with t...
No
4
49
Model_Evaluation
compute_test_metric
11,656,525
1
A
0
0
0
0
0
9
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
684
r=RandomForestRegressor() r=r.fit(X_train,Y_train) pred=r.predict(X_test) s=mean_absolute_error(Y_test,pred) s1=mean_squared_error(Y_test,pred) s2=r2_score(Y_test,pred) print("The MAE with the RandomForestRegressor is: "+str(s)) print("The MsE with the RandomForestRegressor is: "+str(s1)) print("The R2_Score with the R...
No
4
49
Model_Evaluation
compute_test_metric
11,656,525
1
A
0
0
0
0
0
9
ok
10
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"]
8
B
685
x=XGBRegressor() x=dr.fit(X_train,Y_train) pred=x.predict(X_test) s=mean_absolute_error(Y_test,pred) s1=mean_squared_error(Y_test,pred) s2=r2_score(Y_test,pred) print("The MAE with the XGBRegressor is: "+str(s)) print("The MsE with the XGBRegressor is: "+str(s1)) print("The R2_Score with the XGBRegressor is: "+str(s2))
Yes
3
7
Model_Train
train_model
11,656,525
1
A
0
0
0
0
0
9
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
686
df_t=pd.read_csv("/kaggle/input/restaurant-revenue-prediction/test.csv.zip") df_t.head() i_d=df_t['Id'] df_t=df_t.drop('Id',axis=1)'
Yes
3
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
687
df_t['Open Date']=pd.to_datetime(df_t['Open Date'])
Yes
5
16
Data_Transform
data_type_conversions
11,656,525
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"]
8
A
688
df_t['month']=[x.month for x in df_t['Open Date']] df_t['year']=[x.year for x in df_t['Open Date']]
Yes
5
8
Data_Transform
feature_engineering
11,656,525
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"]
8
A
689
df_t=df_t.drop('Open Date',axis=1) df_t['Type'].value_counts() ty={'FC':0,'IL':1,'DT':2} df_t['Type']=df_t['Type'].map(ty) cg={'Big Cities':0,'Other':1} df_t['City Group']=df_t['City Group'].map(cg) x=0 c={} for i in df_t['City'].unique(): c.update({i:x}) x=x+1 df_t['City']=df_t['City'].map(c)
Yes
5
8
Data_Transform
feature_engineering
11,656,525
1
A
0
1
1
0
0
12
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"]
8
A
690
df_t.head()
No
2
45
Data_Extraction
load_from_csv
11,656,525
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
691
df_t.dropna
No
5
17
Data_Transform
correct_missing_values
11,656,525
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
692
df_t['Type']=df_t['Type'].fillna(0)
No
5
17
Data_Transform
correct_missing_values
11,656,525
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"]
8
A
693
df_t.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
694
p=k.predict(df_t)
No
5
48
Model_Evaluation
predict_on_test
11,656,525
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"]
8
A
695
sub=pd.read_csv("/kaggle/input/restaurant-revenue-prediction/sampleSubmission.csv") sub['Id']=i_d'
No
5
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
696
sub.to_csv("Submission1.csv",index=False)
No
5
25
Data_Export
save_to_csv
11,656,525
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
697
b"import pandas as pd\n\ntrain = pd.read_csv('/kaggle/input/restaurant-revenue-prediction/train.csv.zip')\ntest = pd.read_csv('/kaggle/input/restaurant-revenue-prediction/test.csv.zip')\n\n# Id\ntrain_Id = train.Id\ntest_Id = test.Id\n\n# Id\ntrain.drop('Id', axis=1, inplace=True)\ntest.drop('Id', axis=1, inplace=True)...
No
3
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
698
#importing the libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt # import seaborn as sns import seaborn as sns; sns.set(style="ticks", color_codes=True) from datetime import datetime from scipy import stats from scipy.stats import norm, skew from sklearn.preprocessing import StandardScal...
No
4
23
Environment
set_options
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
699
print('Size of train data', train.shape) print('Size of test data', test.shape)
No
5
58
Debug
show_shape
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
700
train.describe(include='O')
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
702
train["revenue"].describe()
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
703
#revenueQ-Q # fig = plt.figure(figsize=(10, 4)) plt.subplots_adjust(wspace=0.4) # ax = fig.add_subplot(1, 2, 1) sns.distplot(train['revenue'], ax=ax) # QQ ax2 = fig.add_subplot(1, 2, 2) stats.probplot(train['revenue'], plot=ax2) plt.show() # print(train['revenue'].describe()) print("-----------------------------...
No
3
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
704
# dataframe df = train.copy() #log(x+1) df['revenue'] = np.log1p(df['revenue']) # (0, 1) scaler=StandardScaler() df['revenue']=scaler.fit_transform(df[['revenue']]) # fig = plt.figure(figsize=(10, 4)) plt.subplots_adjust(wspace=0.4) # ax = fig.add_subplot(1, 2, 1) sns.distplot(df['revenue'], ax=ax) # QQ ax2 = fi...
Yes
2
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
705
# dataframe df = train.copy() # (0, 1) scaler=StandardScaler() df['revenue']=scaler.fit_transform(df[['revenue']]) # fig = plt.figure(figsize=(10, 4)) plt.subplots_adjust(wspace=0.4) # ax = fig.add_subplot(1, 2, 1) sns.distplot(df['revenue'], ax=ax) # QQ ax2 = fig.add_subplot(1, 2, 2) stats.probplot(df['revenue'...
Yes
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
706
# dataframe df = train.copy() # Min-Max((1, 0)) scaler=MinMaxScaler() df['revenue']=scaler.fit_transform(df[['revenue']]) # fig = plt.figure(figsize=(10, 4)) plt.subplots_adjust(wspace=0.4) # ax = fig.add_subplot(1, 2, 1) sns.distplot(df['revenue'], ax=ax) # QQ ax2 = fig.add_subplot(1, 2, 2) stats.probplot(df['re...
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
707
b"# \n# Open Date\ntrain['pd_date'] = pd.to_datetime(train['Open Date'], format='%m/%d/%Y')\n# \ntrain['Open_Year'] = train['pd_date'].dt.strftime('%Y')\n# \ntrain['Open_Month'] = train['pd_date'].dt.strftime('%m')\n\ntrain = train.drop('pd_date',axis=1)\ntrain = train.drop('Open Date',axis=1)"
Yes
3
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
708
b"# \n# Open Date\ntest['pd_date'] = pd.to_datetime(test['Open Date'], format='%m/%d/%Y')\n# \ntest['Open_Year'] = test['pd_date'].dt.strftime('%Y')\n# \ntest['Open_Month'] = test['pd_date'].dt.strftime('%m')\n\ntest = test.drop('pd_date',axis=1)\ntest = test.drop('Open Date',axis=1)"
Yes
3
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
709
train.dtypes.value_counts()
No
5
72
EDA
count_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
710
b"#\ncats = list(train.select_dtypes(include=['object']).columns)\nnums = list(train.select_dtypes(exclude=['object']).columns)\nprint(f'categorical variables: {cats}')\nprint(f'numerical variables: {nums}')"
No
3
37
EDA
count_data_types
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
711
train.nunique(axis=0)
No
5
54
EDA
count_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
712
columns = len(nominal_list)/2+1 fig = plt.figure(figsize=(30, 20)) plt.subplots_adjust(hspace=0.6, wspace=0.4) for i in range(len(nominal_list)): ax = fig.add_subplot(columns, 2, i+1) sns.countplot(x=nominal_list[i], data=train, ax=ax) plt.xticks(rotation=45) plt.show()
No
5
33
Visualization
distribution
null
1
A
0
1
1
0
0
8
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
713
columns = len(num_list)/3+1 fig = plt.figure(figsize=(30, 40)) plt.subplots_adjust(hspace=0.6, wspace=0.4) for i in range(len(num_list)): ax = fig.add_subplot(columns, 3, i+1) train[num_list[i]].hist(ax=ax) ax2 = train[num_list[i]].plot.kde(ax=ax, secondary_y=True,title=num_list[i]) ax2.set_ylim(0) ...
No
5
33
Visualization
distribution
null
1
A
0
1
1
0
0
9
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
714
columns = len(nominal_list)/2+1 fig = plt.figure(figsize=(20, 10)) plt.subplots_adjust(hspace=0.6, wspace=0.4) for i in range(len(nominal_list)): ax = fig.add_subplot(columns, 2, i+1) # sns.boxplot(x=nominal_list[i], y=train.revenue, data=train, ax=ax) plt.xticks(rotation=45) # # sns.ba...
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