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
933
xgb_model = XGBRegressor(learning_rate=xgb_regressor.best_params_["learning_rate"], colsample_bytree=xgb_regressor.best_params_["colsample_bytree"], max_depth=4, alpha=3, subsample=.5, n_estimators=xgb_regressor.best_params_["n_estimators"], ...
No
3
28
Model_Train
compute_train_metric
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
934
# XGB with early stopping xgb_model.fit(X_train, y_train, early_stopping_rounds=4, eval_set=[(X_test, y_test)], verbose=False) y_train_pred = xgb_model.predict(X_train) y_pred = xgb_model.predict(X_test) print('Train r2 score: ', r2_score(y_train_pred, y_train)) print('Test r2 score: ', r2_score(y_test, y_...
No
3
28
Model_Train
compute_train_metric
12,343,159
1
A
0
0
0
0
0
10
ok
10
7
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
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", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
15
B
935
# XGB Feature Importance, relevant features can be selected based on its score feature_important = xgb_model.get_booster().get_fscore() keys = list(feature_important.keys()) values = list(feature_important.values()) data = pd.DataFrame(data=values, index=keys, columns=['score']).sort_values(by = 'score', ascending=Tru...
No
3
79
Visualization
model_coefficients
12,343,159
1
A
0
0
0
0
0
6
ok
3
2
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Import Checker", "Unit Testing Checker"]
15
A
936
rf_model_en = RandomForestRegressor(max_depth=200, max_features=0.4, min_samples_leaf=3, min_samples_split=6, n_estimators=30, n_jobs=-1, oob_score=True) rf_model_en.fit(X_train, y_train) y_train_pred = rf_model_en.predict(X_train) y_pred = rf_model_en.predict(X_test) print('Train r2 s...
No
4
28
Model_Train
compute_train_metric
12,343,159
1
A
0
0
0
0
0
11
ok
13
9
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
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", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
15
B
937
from numpy import mean from numpy import std from sklearn.datasets import make_regression from sklearn.model_selection import cross_val_score from sklearn.model_selection import RepeatedKFold from sklearn.linear_model import LinearRegression from sklearn.ensemble import StackingRegressor from matplotlib import pyplot ...
No
2
4
Model_Train
choose_model_class
12,343,159
1
A
4
4
1
0
20
36
ok
9
4
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Import Checker", "Missing function docstring", "Unit Testing Checker"]
15
A
938
# define the base models base_models = list() base_models.append(('ridge', ridge_model)) base_models.append(('lasso', lasso_model)) base_models.append(('rf', rf_model_en)) # define meta learner model learner = LinearRegression() # define the stacking ensemble stack1 = StackingRegressor(estimators=base_models, final_est...
No
5
82
Hyperparam_Tuning
define_search_model
12,343,159
1
A
1
0
0
0
5
7
ok
6
5
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Import Checker", "Unit Testing Checker", "Verbose Mode Checker"]
15
B
939
pivot=pd.pivot_table(train_df,columns='Country_Region',index='Date',values='ConfirmedCases',aggfunc=np.sum) pivot_fatality=pd.pivot_table(train_df,columns='Country_Region',index='Date',values='Fatalities',aggfunc=np.sum) country_list=[] value_list=[] fatality_list=[] for country in list(pivot.columns): country_list...
No
5
33
Visualization
distribution
8,604,602
1
A
1
1
1
0
5
20
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"]
5
A
940
top_confirmed=df.sort_values(by='Confirmed',ascending=False)[:10]
No
5
9
Data_Transform
sort_values
8,604,602
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
941
times_series_cntr = train_df.groupby(['Date','Country_Region'])['ConfirmedCases'].sum()\\ .reset_index().set_index('Date') df_countries_tm = times_series_cntr[times_series_cntr['Country_Region'].isin(list_countries)] plt.figure(figsize=(16,12)) ax = sns.lineplot(x=df_countries_tm.index, y="Confirm...
No
5
81
Visualization
relationship
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
942
from sklearn import linear_model import numpy from sklearn.ensemble import RandomForestRegressor cls = RandomForestRegressor(n_estimators=100) cls.fit(X_train, Y_train) pred = cls.predict(X_test) pred = numpy.exp(pred) cls.score(X_train, Y_train)
No
2
7
Model_Train
train_model
5,466,844
1
A
2
0
0
0
10
8
ok
12
9
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 1"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
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", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
3
B
943
output = pd.DataFrame({'Id': test['Id'], 'Prediction': pred}) output.to_csv('submission.csv', index=False)
No
5
25
Data_Export
save_to_csv
5,466,844
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 1"}]
A
no applicable ML-specific findings
[]
["Import Checker"]
3
A
944
# 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 in import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O...
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
945
#dependencies import pandas as pd import keras import tensorflow as tf import matplotlib.pyplot as plt from matplotlib import style from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler from sklearn import preprocessing, svm from keras.models import Sequential from keras....
No
5
23
Environment
set_options
8,620,454
1
A
0
0
0
0
0
31
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"]
14
A
946
df_train = pd.read_csv('../input/covid19-global-forecasting-week-2/train.csv', index_col=0)
No
5
45
Data_Extraction
load_from_csv
8,620,454
1
A
0
0
0
0
0
1
ok
2
2
[{"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"]
14
A
947
#df_train['Fatalities'].plt.show() df_train.drop(columns=['Province_State'], inplace=True)
No
4
10
Data_Transform
drop_column
8,620,454
1
A
0
0
0
0
0
1
ok
4
4
[{"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 16"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Logging Checker", "fi...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "InPlace Checker", "Logging Checker"]
14
B
948
df_train.fillna(0, inplace=True) #df_train.set_index('Date', inplace=True)
No
5
17
Data_Transform
correct_missing_values
8,620,454
1
A
0
0
0
0
0
1
ok
4
4
[{"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 15"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Logging Checker", "fi...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "InPlace Checker", "Logging Checker"]
14
B
949
testData = pd.read_csv("../input/test.csv") submission = pd.DataFrame({ "Id": testData["Id"], "Prediction": pred }) submission.to_csv('RandomForestSimple.csv',header=True, index=False)'
No
4
45
Data_Extraction
load_from_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
950
le = preprocessing.LabelEncoder() df_train['Country_Region'] = le.fit_transform(df_train['Country_Region']) df_train['Date'] = le.fit_transform(df_train['Date']) df_train
No
5
20
Data_Transform
categorify
8,620,454
1
A
0
0
0
1
0
4
ok
13
11
[{"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": "Pipeline Che...
D
Cross Validation Checker=low, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
951
X = df_train.drop(columns=['Fatalities','ConfirmedCases']) scaler = MinMaxScaler(feature_range=(0,1)) scaled_data = scaler.fit_transform(X) #t_scaled_data = preprocessing.scale(X) X= np.array(X) X = preprocessing.scale(X)
No
3
10
Data_Transform
drop_column
8,620,454
1
A
1
0
0
0
5
5
ok
11
11
[{"detector": "framework_specific", "framework": "NumPy", "name": "Array Creation Efficiency", "fix": "Specify dtype when creating arrays.", "benefits": "Improves memory efficiency and avoids unnecessary conversions.", "location": "Line 18"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Loggin...
D
Cross Validation Checker=low, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["Array Creation Efficiency", "Dependent Threshold Checker", "Exception Handling Checker", "Logging Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
952
scaler.scale_ scale=1/ 1.51515152e-02
No
5
53
Other
something_strange
8,620,454
1
A
0
0
0
0
0
2
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"]
14
A
953
# Import necessary libraries import datetime import numpy as np import pandas as pd import matplotlib as plt import warnings warnings.filterwarnings('ignore') # Import ML libraries from sklearn import preprocessing from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import OneHotEncoder from s...
No
5
23
Environment
set_options
8,625,834
1
A
0
0
0
0
0
17
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"]
12
A
954
y = df_train.drop(columns=['Date','Country_Region','Fatalities']) scaler = MinMaxScaler(feature_range=(0,1)) scaled_data = scaler.fit_transform(y) y = np.array(y) y = preprocessing.scale(y)
No
2
10
Data_Transform
drop_column
8,620,454
1
A
0
0
0
0
0
5
ok
11
11
[{"detector": "framework_specific", "framework": "NumPy", "name": "Array Creation Efficiency", "fix": "Specify dtype when creating arrays.", "benefits": "Improves memory efficiency and avoids unnecessary conversions.", "location": "Line 18"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Loggin...
D
Cross Validation Checker=low, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["Array Creation Efficiency", "Dependent Threshold Checker", "Exception Handling Checker", "Logging Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
955
# Load and read files submission_example = pd.read_csv("../input/covid19-global-forecasting-week-2/submission.csv") train_df = pd.read_csv('../input/covid19-global-forecasting-week-2/train.csv') test_df = pd.read_csv('../input/covid19-global-forecasting-week-2/test.csv') # Rename columns train_df.rename(columns={'Coun...
No
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
956
# Transform the normal date to pandas datetime train_df['Date'] = pd.to_datetime(train_df['Date']) test_df['Date'] = pd.to_datetime(test_df['Date']) display(train_df.head(5)) display(test_df.head(5))
No
4
16
Data_Transform
data_type_conversions
8,625,834
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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker"]
12
B
957
19698-15523
No
5
53
Other
something_strange
8,620,454
1
A
0
0
0
1
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"]
14
A
958
X.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
959
X_train,X_test, y_train, y_test = train_test_split(X, y, test_size=0.20)
No
5
13
Data_Transform
split
8,620,454
1
A
0
0
0
0
0
1
ok
4
4
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Logging Checker", "fix": "Implement TensorBoard logging.", "benefits": "Enables better experiment tracking and visualization.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix...
B
Cross Validation Checker=low, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Dependent Threshold Checker", "Logging Checker"]
14
B
960
X_train.shape[1]
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
961
#X_train = np.reshape(X_train, (X_train.shape[0], X_train.shape[1], 1)) #X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1)) #X_train.shape
No
1
53
Other
something_strange
8,620,454
1
A
1
0
0
0
5
0
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"]
14
A
962
model = XGBRegressor(n_estimators=1000)
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
963
model.fit(X_train, y_train) #,batch_size = 50, epochs= 20)
No
5
7
Model_Train
train_model
8,620,454
1
A
0
0
0
0
0
1
ok
8
8
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Memory Release Checker", "fix": "Clear session after model creation/training using tf.keras.backend.clear_session().", "benefits": "Prevents memory leaks and reduces resource usage.", "location": ""}, {"detector": "framework_specific", "framework":...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Logging Checker", "Memory Release Checker", "Model Evaluation Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
B
964
# Use the forest's predict method on the test data prediction_s = model.predict(X_test) # Calculate the absolute errors errors_s = abs(prediction_s - y_test) # Print out the mean absolute error (mae) print('Mean Absolute Error:', round(np.mean(errors_s), 2), 'degrees.')
No
4
27
Model_Train
predict_on_train
8,620,454
1
A
0
0
0
0
0
3
ok
5
5
[{"detector": "framework_specific", "framework": "NumPy", "name": "Missing Axis Specification", "fix": "Specify axis in array operations.", "benefits": "Improves performance and avoids unexpected behaviour.", "location": "Line 20"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Memory Release C...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Memory Release Checker", "Unit Testing Checker"]
14
C
965
accuracy = model.score(X_test, y_test) #test Accuracy squared error for linreg
No
5
49
Model_Evaluation
compute_test_metric
8,620,454
1
A
0
0
0
0
0
1
ok
3
3
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Model Evaluation Checker", "fix": "Evaluate model performance using model.evaluate().", "benefits": "Provides standardized model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Thresh...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Model Evaluation Checker", "Unit Testing Checker"]
14
A
966
# Shape of training data print(train_df.shape) # Number of missing values in each column of training data missing_train_count_col = (train_df.isnull().sum()) print(missing_train_count_col[missing_train_count_col>0]) # Shape of testing data print(test_df.shape) # Number of missing values in each column of training dat...
No
4
39
EDA
count_missing_values
8,625,834
1
A
0
0
0
0
0
6
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", "Dependent Threshold Checker"]
12
B
967
# define the base models base_model = list() base_model.append(('rf1', rf_model)) base_model.append(('rf2', rf_model_en)) base_model.append(('rf3', RandomForestRegressor(max_depth=8, max_features=0.1, min_samples_leaf=3, min_samples_split=2, n_estimators=250, n_jobs=-1, ...
No
4
7
Model_Train
train_model
12,343,159
1
A
1
0
0
0
5
8
ok
8
6
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
B
Cross Validation Checker=low, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "Import Checker", "Unit Testing Checker", "Verbose Mode Checker"]
15
B
968
df_t = pd.read_csv('../input/covid19-global-forecasting-week-2/test.csv',index_col=0)
No
5
45
Data_Extraction
load_from_csv
8,620,454
1
A
0
0
0
0
0
1
ok
2
2
[{"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"]
14
A
969
df_t.drop(columns=['Province_State'], inplace=True)
No
5
10
Data_Transform
drop_column
8,620,454
1
A
0
0
0
0
0
1
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 15"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "InPlace Checker"]
14
A
970
df_t
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
971
df_t['Country_Region'] = le.fit_transform(df_t['Country_Region']) df_t['Date'] = le.fit_transform(df_t['Date'])
No
5
20
Data_Transform
categorify
8,620,454
1
A
0
0
0
0
0
2
ok
12
10
[{"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, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
972
submission = pd.DataFrame(columns=['Id','Prediction']) submission['Id'] = test_df['Id'] ridge_pred = ridge_model.predict(test_df.drop('Id', axis=1)) submission['Prediction'] = np.expm1(ridge_pred) submission.to_csv('submission_ridge.csv',index=False) lasso_pred = lasso_model.predict(test_df.drop('Id', axis=1)) submis...
Yes
4
25
Data_Export
save_to_csv
12,343,159
1
A
0
0
0
0
0
29
ok
14
5
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 9"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
15
B
973
#df_t = np.array(scaled_data) #t_scaled_data = scaler.fit_transform(df_t) #t_scaled_data = preprocessing.scale(df_t)
No
1
53
Other
something_strange
8,620,454
1
A
1
0
0
0
5
0
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"]
14
A
974
#Libraries to import import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import datetime as dt import pycountry import plotly_express as px sns.set_style('darkgrid') %matplotlib inline import warnings warnings.filterwarnings('ignore') from sklearn.preprocessing import OrdinalEn...
No
4
22
Environment
import_modules
8,628,909
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
975
df_train = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-2/train.csv') df_test = pd.read_csv('/kaggle/input/covid19-global-forecasting-week-2/test.csv')
No
5
45
Data_Extraction
load_from_csv
8,628,909
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
976
test_predictions = model.predict(subt_data) test_predictions.shape
No
4
27
Model_Train
predict_on_train
8,620,454
1
A
0
0
0
0
0
2
ok
4
4
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Memory Release Checker", "fix": "Clear session after model creation/training using tf.keras.backend.clear_session().", "benefits": "Prevents memory leaks and reduces resource usage.", "location": ""}, {"detector": "framework_specific", "framework":...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Exception Handling Checker", "Memory Release Checker", "Unit Testing Checker"]
14
A
977
#test_predictions = test_predictions.reshape(12642,) #test_predictions = test_predictions.reshape(-1, 3)
No
1
53
Other
something_strange
8,620,454
1
A
1
0
0
0
5
0
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"]
14
A
978
#test_predictions = scaler.inverse_transform(test_predictions)
No
1
53
Other
something_strange
8,620,454
1
A
1
0
0
0
5
0
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"]
14
A
979
display(df_train.head()) display(df_train.describe()) display(df_train.info())
No
3
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
980
#INVERSE TRANSFORM #test_predictions = test_predictions.reshape(12642,) #test_predictions_c = test_predictions* scale
No
1
53
Other
something_strange
8,620,454
1
A
0
0
0
0
0
0
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"]
14
A
981
df_train['Date'] = pd.to_datetime(df_train['Date'], format = '%Y-%m-%d') df_test['Date'] = pd.to_datetime(df_test['Date'], format = '%Y-%m-%d')
No
5
16
Data_Transform
data_type_conversions
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
982
#test_predictions = test_predictions.reshape(12642,) test_predictions = test_predictions_c
No
4
12
Data_Transform
create_dataframe
8,620,454
3
C
1
0
0
0
5
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"]
14
C
983
print('Minimum date from training set: {}'.format(df_train['Date'].min())) print('Maximum date from training set: {}'.format(df_train['Date'].max()))
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
984
b"# Fill null values\ntrain_df['State'].fillna('No State', inplace=True)\ntest_df['State'].fillna('No State', inplace=True)\n\n# Number of missing values in each column of training data\nmissing_train_count_col = (train_df.isnull().sum())\nprint(missing_train_count_col[missing_train_count_col>0])\n\n# Number of missing...
No
3
17
Data_Transform
correct_missing_values
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
985
b"# Apply Label Encoding to train and test data\ntrain_df_encoded = train_df.copy()\ntest_df_encoded = test_df.copy()\n\n# Initialize Label encoder\nle = LabelEncoder()\n\n# Create date time features\ndef create_time_features(df):\n df['date'] = df['Date']\n df['hour'] = df['date'].dt.hour\n df['dayofweek'] = ...
No
4
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
986
df_sub = pd.read_csv('../input/covid19-global-forecasting-week-2/submission.csv') df_sub.drop(columns=['Fatalities','ConfirmedCases'], inplace=True) save_file_c = pd.DataFrame(test_predictions_c, columns=[['ConfirmedCases']]) result_c = pd.merge(df_sub, save_file_c,left_index=True, right_index=True) result_c.columns ...
No
4
12
Data_Transform
create_dataframe
8,620,454
1
A
0
0
0
0
0
5
ok
4
4
[{"detector": "framework_specific", "framework": "Pandas", "name": "Merge Parameter Checker", "fix": "Specify how, on, and validate parameters in merge operations.", "benefits": "Ensures accurate data merging and prevents data loss.", "location": "Line 20"}, {"detector": "framework_specific", "framework": "Pandas", "na...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Hardcoded file path", "InPlace Checker", "Merge Parameter Checker"]
14
A
987
print('Minimum date from test set: {}'.format(df_test['Date'].min())) print('Maximum date from test set: {}'.format(df_test['Date'].max()))
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
988
result_c = pd.merge(df_t,result_c ,on='ForecastId') df_t.drop(columns=['Country_Region'], inplace=True) #result_c.drop(columns=['Country_Region_y','Country_Region_x'], inplace=True
No
4
10
Data_Transform
drop_column
8,620,454
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 16"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "InPlace Checker"]
14
A
989
# Specify all features for prediction x_features_drop = ['ConfirmedCases', 'Fatalities', 'Date', 'date'] y_target1 = ['ConfirmedCases'] y_target2 = ['Fatalities'] # Assign features into X, y1, y2 for training and testing X = train_df_encoded.drop(x_features_drop, axis=1) y1 = train_df_encoded[y_target1] y2 = train_df_...
No
4
10
Data_Transform
drop_column
8,625,834
1
A
0
0
0
0
0
9
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
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker"]
12
B
990
df_map = df_train.copy() df_map['Date'] = df_map['Date'].astype(str) df_map = df_map.groupby(['Date','Country_Region'], as_index=False)['ConfirmedCases','Fatalities'].sum()
No
3
60
Data_Transform
groupby
null
1
A
0
0
0
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
991
def get_iso3_util(country_name): try: country = pycountry.countries.get(name=country_name) return country.alpha_3 except: if 'Congo' in country_name: country_name = 'Congo' elif country_name == 'Diamond Princess' or country_name == 'Laos': return country_n...
No
5
8
Data_Transform
feature_engineering
8,628,909
1
A
1
5
9
0
5
22
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
992
df_map['ln(ConfirmedCases)'] = np.log(df_map.ConfirmedCases + 1) df_map['ln(Fatalities)'] = np.log(df_map.Fatalities + 1)
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
993
b"# # Split into validaion and training data on 2 features\nrft1_train_X, rft1_val_X, rft1_train_y, rft1_val_y = train_test_split(X, y1, train_size=0.8, test_size=0.2, random_state=1)\nrft2_train_X, rft2_val_X, rft2_train_y, rft2_val_y = train_test_split(X, y2, train_size=0.8, test_size=0.2, random_state=2)\n\n# Define...
No
5
3
Hyperparam_Tuning
find_best_model_class
null
1
A
0
0
0
0
0
0
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
994
result_c.set_index('ForecastId', inplace=True)
No
5
84
Other
not_enough_vertices
8,620,454
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"]
14
A
995
result_c['ConfirmedCases'] = [0 if result_c.loc[i, 'ConfirmedCases'] <= -0 else result_c.loc[i, 'ConfirmedCases'] for i in result_c.index]
No
5
8
Data_Transform
feature_engineering
8,620,454
1
A
0
1
1
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"]
14
A
996
#Fatalities X X = df_train.drop(columns=['Fatalities', ]) scaler = MinMaxScaler(feature_range=(0,1)) scaled_data = scaler.fit_transform(X) #t_scaled_data = preprocessing.scale(X) X= np.array(X) X = preprocessing.scale(X)
No
3
10
Data_Transform
drop_column
8,620,454
1
A
1
0
0
0
5
5
ok
11
11
[{"detector": "framework_specific", "framework": "NumPy", "name": "Array Creation Efficiency", "fix": "Specify dtype when creating arrays.", "benefits": "Improves memory efficiency and avoids unnecessary conversions.", "location": "Line 19"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Loggin...
D
Cross Validation Checker=low, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["Array Creation Efficiency", "Dependent Threshold Checker", "Exception Handling Checker", "Logging Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
997
#Fatalities y y = df_train.drop(columns=['Date','Country_Region','ConfirmedCases']) scaler = MinMaxScaler(feature_range=(0,1)) scaled_data = scaler.fit_transform(y) y = np.array(y) y = preprocessing.scale(y)
No
4
10
Data_Transform
drop_column
8,620,454
1
A
0
0
0
0
0
5
ok
11
11
[{"detector": "framework_specific", "framework": "NumPy", "name": "Array Creation Efficiency", "fix": "Specify dtype when creating arrays.", "benefits": "Improves memory efficiency and avoids unnecessary conversions.", "location": "Line 19"}, {"detector": "framework_specific", "framework": "TensorFlow", "name": "Loggin...
D
Cross Validation Checker=low, Cross-validation not detected=low, Data Leakage Checker=high, No random seed setting detected=low, Pipeline Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Pipeline Checker", "severity": "low"}]
["Array Creation Efficiency", "Dependent Threshold Checker", "Exception Handling Checker", "Logging Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
998
# Choose best Random Forest Model for y1 and y2 best_rf_model_y1 = model_2 best_rf_model_y2 = model_2 # Assign features to test data x_test_features_drop = ['Date', 'date'] X_test = test_df_encoded.drop(x_test_features_drop, axis=1) # Predict the best model for y1 and y2 y1_pred = best_rf_model_y1.predict(X_test) y2_...
No
4
48
Model_Evaluation
predict_on_test
8,625,834
1
A
0
0
0
0
0
8
ok
7
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": "Dependent Th...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
12
B
999
# Save predictions in format used for competition scoring output = pd.DataFrame({'ForecastId': test_df.ForecastId, 'ConfirmedCases': rnd_y1_pred, 'Fatalities': rnd_y2_pred}) output.to_csv('submission.csv', index=False) print(output.tail(10)) print('Submission file successfully saved..')
No
5
25
Data_Export
save_to_csv
8,625,834
1
A
0
0
0
0
0
4
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"]
12
A
1,000
#X_train = np.reshape(X_train, (X_train.shape[0], X_train.shape[1], 1)) #X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1)) X_train.shape
No
5
58
Debug
show_shape
8,620,454
3
C
1
0
0
0
5
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"]
14
C
1,001
px.choropleth(df_map, locations="iso_alpha", color="ln(ConfirmedCases)", hover_name="Country_Region", hover_data=["ConfirmedCases"] , animation_frame="Date", color_continuous_scale=px.colors.sequential.dense, title='D...
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
1,002
model1 = XGBRegressor(n_estimators=1000)
No
5
4
Model_Train
choose_model_class
8,620,454
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"]
14
A
1,003
px.choropleth(df_map, locations="iso_alpha", color="ln(Fatalities)", hover_name="Country_Region", hover_data=["Fatalities"], animation_frame="Date", color_continuous_scale=px.colors.sequential.OrRd, title = 'Daily Death...
No
4
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,004
#Compile the model, because this is a binary classification problem, accuracy can be used #model1.compile(optimizer='Adam', loss= 'mean_squared_error')
No
1
53
Other
something_strange
8,620,454
1
A
0
0
0
0
0
0
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"]
14
A
1,005
training = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-2/train.csv") testing = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-2/test.csv") data_ = pd.read_csv("/kaggle/input/covid19-demographic-predictors/covid19_by_country.csv")
No
5
45
Data_Extraction
load_from_csv
8,658,083
1
A
0
0
0
0
0
3
ok
4
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
1,006
model1.fit(X_train, y_train)#, batch_size = 50, epochs= 20)
No
5
7
Model_Train
train_model
8,620,454
1
A
0
0
0
0
0
1
ok
6
6
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Model Evaluation Checker", "fix": "Evaluate model performance using model.evaluate().", "benefits": "Provides standardized model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Model Evaluation Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
B
1,007
train_c = result_c train_c = scaler.fit_transform(train_c) train_c= np.array(train_c) train_c = preprocessing.scale(train_c) #train_c = np.reshape(train_c, (train_c.shape[0], train_c.shape[1], 1))
No
4
18
Data_Transform
normalization
8,620,454
1
A
1
0
0
0
5
4
ok
7
7
[{"detector": "framework_specific", "framework": "NumPy", "name": "Array Creation Efficiency", "fix": "Specify dtype when creating arrays.", "benefits": "Improves memory efficiency and avoids unnecessary conversions.", "location": "Line 17"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross...
D
Cross Validation Checker=low, Data Leakage Checker=high
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}]
["Array Creation Efficiency", "Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
14
D
1,008
pred_f = model1.predict(train_c) #pred_f = pred_f.reshape(-1,3)
No
5
27
Model_Train
predict_on_train
8,620,454
3
C
1
0
0
0
5
1
ok
4
4
[{"detector": "framework_specific", "framework": "TensorFlow", "name": "Memory Release Checker", "fix": "Clear session after model creation/training using tf.keras.backend.clear_session().", "benefits": "Prevents memory leaks and reduces resource usage.", "location": ""}, {"detector": "framework_specific", "framework":...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Exception Handling Checker", "Memory Release Checker", "Unit Testing Checker"]
14
C
1,010
save_file_f = pd.DataFrame(pred_f, columns=['Fatalities']) save_file_f.index += 1
No
5
55
Data_Export
prepare_output
8,620,454
1
A
0
0
0
0
0
2
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"]
14
A
1,011
#Get the top 10 countries last_date = df_train.Date.max() df_countries = df_train[df_train['Date']==last_date] df_countries = df_countries.groupby('Country_Region', as_index=False)['ConfirmedCases','Fatalities'].sum() df_countries = df_countries.nlargest(10,'ConfirmedCases') #Get the trend for top 10 countries df_trend...
No
4
14
Data_Transform
filter
null
1
A
0
0
0
0
0
10
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,012
#change the name of the 'country' feature to match 'Country_Region' on the train set data_['Country_Region']= data_.Country data_.drop('Country',axis=1, inplace =True)
No
4
10
Data_Transform
drop_column
8,658,083
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 6"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker",...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "InPlace Checker"]
3
A
1,013
px.line(df_trend, x='Date', y='Cases', color='Country', title='COVID19 Cases growth for top 10 worst affected countries')
No
5
75
Visualization
time_series
8,628,909
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,014
result = pd.merge(result_c, save_file_f, left_index=True, right_index=True)
No
5
32
Data_Transform
merge
8,620,454
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Merge Parameter Checker", "fix": "Specify how, on, and validate parameters in merge operations.", "benefits": "Ensures accurate data merging and prevents data loss.", "location": "Line 15"}, {"detector": "framework_specific", "framework": "ScikitLearn"...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Merge Parameter Checker"]
14
A
1,015
training.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
1,017
px.line(df_trend, x='Date', y='Deaths', color='Country', title='COVID19 Deaths growth for top 10 worst affected countries')
No
5
75
Visualization
time_series
8,628,909
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,018
print(data_.shape) print(training.shape)
No
5
58
Debug
show_shape
8,658,083
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
1,019
result
No
5
41
Debug
show_table
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,020
px.line(df_trend, x='Date', y='ln(Cases)', color='Country', title='COVID19 Cases growth for top 10 worst affected countries(Logarithmic Scale)')
No
5
75
Visualization
time_series
8,628,909
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,022
#missing values training.isnull().sum()
No
5
39
EDA
count_missing_values
8,658,083
1
A
0
0
0
0
0
1
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
1,023
px.line(df_trend, x='Date', y='ln(Deaths)', color='Country', title='COVID19 Deaths growth for top 10 worst affected countries(Logarithmic Scale)')
No
5
75
Visualization
time_series
8,628,909
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,024
submission = result
No
5
77
Other
define_variables
8,620,454
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"]
14
A
1,025
#missing values data_.isnull().sum()
No
5
39
EDA
count_missing_values
8,658,083
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
1,026
data_['Quarantine_date'] = pd.to_datetime(data_.Quarantine) data_['Restrictions_date'] = pd.to_datetime(data_.Restrictions) data_['Schools_date'] = pd.to_datetime(data_.Schools) data_.drop(['Schools', 'Restrictions', 'Quarantine'], axis =1, inplace = True)
No
4
16
Data_Transform
data_type_conversions
8,658,083
1
A
0
0
0
0
0
4
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 7"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker",...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "InPlace Checker"]
3
A
1,027
submission['Fatalities'] = [0 if submission.loc[i, 'Fatalities'] < 0 else submission.loc[i, 'Fatalities'] for i in submission.index]
No
5
8
Data_Transform
feature_engineering
8,620,454
1
A
0
1
1
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"]
14
A
1,028
training.Date = pd.to_datetime(training.Date)
No
5
16
Data_Transform
data_type_conversions
8,658,083
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
1,030
submission
No
5
41
Debug
show_table
8,620,454
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
14
null
1,031
training = training.fillna({'Province_State': 'Unknown'}) testing = testing.fillna({'Province_State': 'Unknown'})
No
5
17
Data_Transform
correct_missing_values
8,658,083
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"}]
[]
3
B
1,032
df_us = df_train[df_train['Country_Region']=='US'] df_us['Date'] = df_us['Date'].astype(str) df_us['state_code'] = df_us.apply(lambda x: us_state_abbrev.get(x.Province_State,float('nan')), axis=1) df_us['ln(ConfirmedCases)'] = np.log(df_us.ConfirmedCases + 1) df_us['ln(Fatalities)'] = np.log(df_us.Fatalities + 1)
No
4
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
5
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
1,033
submission.drop(columns=['Country_Region','Date'], inplace=True)
No
5
10
Data_Transform
drop_column
8,620,454
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
14
null
1,034
data_.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
1,035
px.choropleth(df_us, locationmode="USA-states", scope="usa", locations="state_code", color="ln(ConfirmedCases)", hover_name="Province_State", hover_data=["ConfirmedCases"], animation_frame="Date", color_conti...
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
1,036
px.choropleth(df_us, locationmode="USA-states", scope="usa", locations="state_code", color="ln(Fatalities)", hover_name="Province_State", hover_data=["Fatalities"], animation_frame="Date", color_continuous_sc...
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