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
305
# build final model with best params from grid search cv final_regressor = build_regressor(optimizer=gridsearch.best_params_['optimizer'], lstm_nodes=gridsearch.best_params_['lstm_nodes'])
No
5
4
Model_Train
choose_model_class
8,705,213
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
306
# fit final model final_regressor.fit(x, y, epochs=gridsearch.best_params_['nb_epoch'], batch_size=gridsearch.best_params_['batch_size'], verbose=0, shuffle=False)
No
5
7
Model_Train
train_model
8,705,213
1
A
0
0
0
0
0
5
ok
3
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker"]
5
B
307
test_data['Date'] = pd.to_datetime(test_data['Date']) test_data.Date.max()-test_data.Date.min()
No
3
16
Data_Transform
data_type_conversions
8,705,213
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"]
5
A
308
# first batch of predictions first_predict_date = pd.to_datetime('2020-03-19') pred_data = {key:region_dfs[key].loc[(region_dfs[key]['Date']>=(first_predict_date-pd.DateOffset(days=n_in)))& (region_dfs[key]['Date']<first_predict_date)] for key in region_dfs} test_reshap...
No
3
27
Model_Train
predict_on_train
8,705,213
1
A
0
0
0
0
0
7
ok
4
4
[{"detector": "framework_specific", "framework": "Pandas", "name": "DataFrame Conversion Checker", "fix": "Use .to_numpy() instead of .values.", "benefits": "Ensures future compatibility and avoids unexpected behaviour.", "location": "Line 11"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "DataFrame Conversion Checker", "Exception Handling Checker", "Unit Testing Checker"]
5
A
309
# iterate prediction output back into model input for the next days pin = [first_input] pout = [first_pred] # first prediction is done outside of loop, need to loop for following 41 days for i in range(42): p = final_regressor.predict(pin[i]) pout.append(p) t= np.insert(pin[i],n_in,pout[i],axis=1)[:,1:,:] ...
No
4
27
Model_Train
predict_on_train
8,705,213
1
A
0
1
1
0
0
7
ok
3
3
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"]
5
A
310
# create the prediction dataframe pred_df = pd.DataFrame(np.concatenate(pout)) pred_df.columns = ['ConfirmedCases_scaled','Fatalities_scaled'] pred_df['Date'] = np.repeat(test_data['Date'].unique(),294) pred_df['Province_State'] = list(test_data.drop_duplicates(subset=['Province_State','Country_Region'])['Province_Stat...
No
4
12
Data_Transform
create_dataframe
8,705,213
1
A
0
0
0
0
0
6
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
5
A
311
# inverse scale results pred_df['ConfirmedCases'] = ( case_scaler.inverse_transform(pred_df['ConfirmedCases_scaled'].values.reshape(1,-1))[0]) pred_df['Fatalities'] = ( fat_scaler.inverse_transform(pred_df['Fatalities_scaled'].values.reshape(1,-1))[0])
No
5
18
Data_Transform
normalization
8,705,213
1
A
0
0
0
0
0
4
ok
10
6
[{"detector": "framework_specific", "framework": "Pandas", "name": "DataFrame Conversion Checker", "fix": "Use .to_numpy() instead of .values.", "benefits": "Ensures future compatibility and avoids unexpected behaviour.", "location": "Line 8"}, {"detector": "framework_specific", "framework": "Pandas", "name": "DataFram...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Column Selection Checker", "DataFrame Conversion Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
5
B
312
pred_df[pred_df['Date']=='2020-04-30'].sum()
No
2
40
Debug
show_table_attributes
8,705,213
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"]
5
A
313
raw_train_data['Date'] = pd.to_datetime(raw_train_data['Date']) test_check = raw_train_data[raw_train_data['Date']>'2020-03-18'] model_check = pred_df[pred_df['Date']<=test_check['Date'].max()]
No
4
53
Other
something_strange
8,705,213
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
5
A
314
np.sqrt(mean_squared_log_error(y_true = test_check[['ConfirmedCases','Fatalities']], y_pred = model_check[['ConfirmedCases','Fatalities']]))
No
5
49
Model_Evaluation
compute_test_metric
8,705,213
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
315
sub = pred_df[['ConfirmedCases','Fatalities']] sub['ForecastId'] = test_data['ForecastId']
No
5
55
Data_Export
prepare_output
8,705,213
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
316
sub.sample(20)
No
5
41
Debug
show_table
8,705,213
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
5
A
317
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
318
import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns import warnings warnings.filterwarnings("ignore")
No
3
22
Environment
import_modules
8,706,858
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
1
null
319
train = pd.read_csv('../input/covid19-global-forecasting-week-2/train.csv') train.info()
No
4
45
Data_Extraction
load_from_csv
8,706,858
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Hardcoded file path"]
1
B
320
train.head()
No
5
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
321
train.tail()
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
322
train.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
323
train.corr()
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
324
train.isnull().sum()
No
5
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
325
test = pd.read_csv('../input/covid19-global-forecasting-week-2/test.csv') test.info()
No
3
45
Data_Extraction
load_from_csv
8,706,858
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/covid19-global-forecasting-week-2/test.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 2"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
1
A
326
test.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
327
test.isnull().sum()
No
5
39
EDA
count_missing_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
328
#Changing dtype for dates from object to datetime train['Date'] = pd.to_datetime(train['Date']) test['Date'] = pd.to_datetime(test['Date'])
No
5
16
Data_Transform
data_type_conversions
8,706,858
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
329
train[train['Province_State'].isnull()]['Country_Region'].unique()
No
3
57
Debug
show_unique_values
8,706,858
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
1
B
330
train[train['Province_State'].notnull()]['Country_Region'].unique()
No
4
57
Debug
show_unique_values
8,706,858
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
1
B
331
train['Province_State'] = np.where(train['Province_State'].isnull(), train['Country_Region'], train['Province_State']) test['Province_State'] = np.where(test['Province_State'].isnull(), test['Country_Region'], test['Province_State'])
No
5
17
Data_Transform
correct_missing_values
8,706,858
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"}]
[]
1
B
332
train[train['Province_State'] == 'Diamond Princess']
No
4
41
Debug
show_table
8,706,858
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
333
train[train['Province_State'] == 'Diamond Princess']['Country_Region'].unique()
No
4
57
Debug
show_unique_values
8,706,858
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}]
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
[]
1
B
334
df = train.append(test)
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
335
group = df.groupby(['Province_State', 'Country_Region'])['Date'].count().reset_index() group
No
5
60
Data_Transform
groupby
8,706,858
1
A
0
0
0
1
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
336
df[df['Province_State'] == 'Georgia']['Country_Region'].unique()
No
4
57
Debug
show_unique_values
8,706,858
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
337
#Distinguishing Province/State Georgia according to Country/Region df['Province_State'] = np.where((df['Country_Region'] == 'Georgia') & (df['Province_State'] == 'Georgia'), 'Country Georgia', df['Province_State'])
No
5
8
Data_Transform
feature_engineering
8,706,858
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
338
#Viewing the total number of confirmeed cases and fatalities worldwide world = train.groupby('Date')['ConfirmedCases', 'Fatalities'].sum().reset_index() plt.plot(world['Date'], world['ConfirmedCases'], label = 'Confirmed Cases') plt.plot(world['Date'], world['Fatalities'], label = 'Fatalities') plt.legend() plt.title(...
No
5
75
Visualization
time_series
8,706,858
1
A
0
0
0
0
0
7
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
1
B
339
#Plotting the number of confirmed cases and fatalities for each country country = train.groupby('Country_Region')['ConfirmedCases', 'Fatalities'].sum().reset_index() fig = plt.figure(figsize = (15, 25)) ax = fig.add_subplot(111) ax.barh(country['Country_Region'], country['ConfirmedCases'],label = 'Confirmed Cases') ax...
No
4
33
Visualization
distribution
8,706,858
1
A
0
0
0
0
0
7
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
1
B
340
#Viewing the top 15 countries with the most confirmed cases ranked = country.sort_values(by = 'ConfirmedCases', ascending = False)[:15] ranked
No
5
9
Data_Transform
sort_values
8,706,858
1
A
0
0
0
1
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
341
#Plotting confirmed cases and fatalities for the 15 countries with the most cases countries = ['China', 'Italy', 'US', 'Spain', 'Germany', 'Iran', 'France', 'Korea, South', 'United Kingdom', 'Switzerland', 'Netherlands', 'Belgium', 'Austria', 'Turkey', 'Canada'] ...
No
4
33
Visualization
distribution
8,706,858
1
A
0
1
1
0
0
12
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
1
B
342
from statsmodels.tsa.seasonal import seasonal_decompose def trends(country, case): group = train[train['Country_Region'] == country].groupby('Date')['ConfirmedCases', 'Fatalities'].sum().reset_index() decomposition = seasonal_decompose(group[case], freq = 3) trend = decomposition.trend seasonal = decom...
No
3
33
Visualization
distribution
8,706,858
1
A
0
1
0
0
0
24
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, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Missing function docstring"]
1
B
343
from statsmodels.tsa.stattools import adfuller def stationarity_test(country, case): timeseries = train[train['Country_Region'] == country].groupby('Date')['ConfirmedCases', 'Fatalities'].sum().reset_index() #Perform Dickey-Fuller test: print('Results of Dickey-Fuller Test:') dftest = adfuller(timeserie...
No
5
47
Model_Evaluation
statistical_test
8,706,858
1
A
0
2
1
0
0
11
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, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Missing function docstring"]
1
B
344
stationarity_test('US', 'ConfirmedCases')
No
5
47
Model_Evaluation
statistical_test
8,706,858
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
345
from statsmodels.tsa.arima_model import ARIMA from sklearn.metrics import mean_squared_error
No
5
22
Environment
import_modules
8,706,858
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
346
def comb_p_d_q(pVals,dVals,qVals): return [(p,d,q) for p in pVals for d in dVals for q in qVals]
No
5
53
Other
something_strange
8,706,858
2
B
3
1
0
0
6
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
B
347
#List of combinations for pdq pdq_results = comb_p_d_q([0,1,2],[0,1,2],[0,1,2]) pdq_results
No
5
53
Other
something_strange
8,706,858
1
A
0
0
0
1
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
348
df.drop_duplicates(subset = ['Date', 'Province_State'], keep = 'last', inplace = True)
No
5
19
Data_Transform
remove_duplicates
8,706,858
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A
349
from datetime import timedelta TEST_DAYS = 7 TRAIN_LAST = - timedelta(days=TEST_DAYS) TEST_FIRST = sub_df["Date"].min() TEST_DAYS = (df["Date"].max() - TEST_FIRST).days + 1 dev_df, test_df = df[df["Date"] < TEST_FIRST].copy(), df[df["Date"] >= TEST_FIRST].copy() dev_df.shape, test_df.shape
No
3
14
Data_Transform
filter
null
1
A
0
0
0
0
0
7
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
350
from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error from sklearn.preprocessing import PolynomialFeatures from sklearn.pipeline import Pipeline model = Pipeline([('poly', PolynomialFeatures(degree=2, include_bias=False)), ('linear', LinearRegression())]) f...
No
3
22
Environment
import_modules
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
351
def rmse(y_true, y_pred): return np.sqrt(mean_squared_error(y_true, y_pred)) def evaluate(df): error = 0 for col in TARGETS: error += rmse(df[col].values, df["pred_{}".format(col)].values) return np.round(error/len(TARGETS), 5) def predict(test_df, first_day, num_days, val=False): y_pred...
No
2
27
Model_Train
predict_on_train
null
1
A
1
9
8
0
8
24
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
352
for col in TARGETS: test_df[col] = np.expm1(test_df[col]) test_df["pred_{}".format(col)] = np.expm1(test_df["pred_{}".format(col)])
No
5
8
Data_Transform
feature_engineering
null
1
A
0
1
1
0
0
3
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
353
SUB_FIRST = sub_df["Date"].min() SUB_DAYS = (sub_df["Date"].max() - sub_df["Date"].min()).days + 1 sub_df = dev_df.append(sub_df, sort=False) for col in TARGETS: sub_df["prev_{}".format(col)] = sub_df.groupby(loc_group)[col].shift() sub_df = sub_df[sub_df["Date"] >= SUB_FIRST].copy() sub_df["ForecastId"] = s...
No
4
8
Data_Transform
feature_engineering
null
1
A
0
2
2
0
0
11
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
354
sub_df.to_csv("submission.csv", index=False, columns=["ForecastId"] + TARGETS)
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
355
submission = pd.read_csv("../input/covid19-global-forecasting-week-2/submission.csv") submission
No
5
45
Data_Extraction
load_from_csv
8,668,446
1
A
0
0
0
1
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/covid19-global-forecasting-week-2/submission.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 7"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
6
A
356
submission['ConfirmedCases'] = sub_df['ConfirmedCases'] submission['Fatalities'] = sub_df['Fatalities'] submission.to_csv('submission.csv', index=False) submission
No
5
25
Data_Export
save_to_csv
8,668,446
1
A
0
0
0
1
0
4
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
6
A
357
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os import matplotlib.pyplot as plt
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
0
A
358
from sklearn.linear_model import ( ElasticNet, ElasticNetCV, Lasso, LassoCV, LinearRegression, LogisticRegression, Ridge, ) from sklearn.ensemble import ( AdaBoostClassifier, GradientBoostingClassifier, GradientBoostingRegressor, RandomForestClassifier, RandomForestRegre...
No
5
22
Environment
import_modules
8,708,118
1
A
0
0
0
0
0
21
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"]
31
A
359
import seaborn as sns from sklearn.base import BaseEstimator from xgboost import XGBClassifier, XGBRegressor import hyperopt as hp from hyperopt import STATUS_OK, Trials, fmin, hp, tpe
No
5
22
Environment
import_modules
8,708,118
1
A
0
0
0
0
0
5
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"]
31
A
360
#Import Date xtrain = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-2/train.csv") xtest = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-2/test.csv") xsubmission = pd.read_csv("/kaggle/input/covid19-global-forecasting-week-2/submission.csv") # view shape of test and train data print(xtrain.shap...
No
4
45
Data_Extraction
load_from_csv
8,708,118
1
A
0
0
0
0
0
5
ok
5
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}, {"detector": "general_ml", "framework": "Genera...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
31
A
361
# view head of train data xtrain.head(10)
No
5
41
Debug
show_table
8,708,118
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker"]
31
B
362
# view head of test data xtest.head(10)
No
5
41
Debug
show_table
8,708,118
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"]
31
A
363
# view head of submission data xsubmission.head(10)
No
5
41
Debug
show_table
8,708,118
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"]
31
A
364
# date wise value count xtrain['Date'].value_counts()
No
4
54
EDA
count_unique_values
8,708,118
1
A
0
0
0
0
0
1
ok
3
3
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Dependent Threshold Checker"]
31
B
365
# create ConfirmedCasesgroup by Province_State statevalue = xtrain.groupby('Province_State').max().ConfirmedCases
No
5
60
Data_Transform
groupby
8,708,118
1
A
0
0
0
0
0
1
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, 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"}]
["Dependent Threshold Checker"]
31
B
366
# view top state conformed cases in a barplot top_states = statevalue.sort_values(ascending = False).head(10) sns.barplot(x=top_states.index, y=top_states.values) plt.xticks(rotation = 'vertical')
No
5
33
Visualization
distribution
8,708,118
1
A
0
0
0
0
0
3
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"]
31
A
367
# make data as integer xtrain.ConfirmedCases = xtrain.ConfirmedCases.astype('int64') xtrain.Fatalities = xtrain.Fatalities.astype('int64')
No
5
16
Data_Transform
data_type_conversions
8,708,118
1
A
0
0
0
0
0
2
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, 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"}]
["Dependent Threshold Checker"]
31
B
368
# Date wise confirm case view in an lineplot plt.figure(figsize=(15,6)) sns.lineplot(x=xtrain.Date,y=xtrain.ConfirmedCases,markers=True,style=True) plt.xticks(rotation = 'vertical')
No
5
75
Visualization
time_series
8,708,118
1
A
0
0
0
0
0
3
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"]
31
A
369
# Date wise Fatalities view in an lineplot plt.figure(figsize=(15,6)) sns.lineplot(x=xtrain.Date,y=xtrain.Fatalities,markers=True,style=True) plt.xticks(rotation = 'vertical')
No
5
33
Visualization
distribution
8,708,118
1
A
0
0
0
0
0
3
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"]
31
A
370
# ConfirmedCases and Fatalities column groupby Country Region df_xtrain = xtrain.groupby(['Country_Region'])[['ConfirmedCases', 'Fatalities']].max() print(df_xtrain.sort_values(by=['ConfirmedCases','Fatalities'],ascending=False).head(10))
No
4
60
Data_Transform
groupby
8,708,118
1
A
0
0
0
0
0
2
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, 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"}]
["Dependent Threshold Checker"]
31
B
371
# view countrywise ConfirmedCases and Fatalities in a plot fig,ax = plt.subplots() fig.set_figheight(10) fig.set_figwidth(40) ax.plot(df_xtrain[:29].index.values,df_xtrain[:29].ConfirmedCases, color="red", marker="o") ax.set_xlabel("Countries",fontsize=24) ax.set_ylabel("Confirmed Cases",color="red",fontsize=24) ax.tic...
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
372
# ConfirmedCases and Fatalities data Analysis Exclude China and view in two Plot confirmed_total_date_noChina = xtrain[xtrain['Country_Region']!='China'].groupby(['Date']).agg({'ConfirmedCases':['sum']}) fatalities_total_date_noChina = xtrain[xtrain['Country_Region']!='China'].groupby(['Date']).agg({'Fatalities':['sum'...
No
5
75
Visualization
time_series
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
373
#ConfirmedCases and Fatalities data Analysis and Visualization for China confirmed_total_date_China = xtrain[xtrain['Country_Region']=='China'].groupby(['Date']).agg({'ConfirmedCases':['sum']}) fatalities_total_date_China = xtrain[xtrain['Country_Region']=='China'].groupby(['Date']).agg({'Fatalities':['sum']}) total_da...
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
374
#For Itally confirmed_total_date_Italy = xtrain[xtrain['Country_Region']=='Italy'].groupby(['Date']).agg({'ConfirmedCases':['sum']}) fatalities_total_date_Italy = xtrain[xtrain['Country_Region']=='Italy'].groupby(['Date']).agg({'Fatalities':['sum']}) total_date_Italy = confirmed_total_date_Italy.join(fatalities_total_d...
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
375
#For UK confirmed_total_date_UK = xtrain[xtrain['Country_Region']=='United Kingdom'].groupby(['Date']).agg({'ConfirmedCases':['sum']}) fatalities_total_date_UK = xtrain[xtrain['Country_Region']=='United Kingdom'].groupby(['Date']).agg({'Fatalities':['sum']}) total_date_UK = confirmed_total_date_UK.join(fatalities_total...
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
376
#For Australia confirmed_total_date_Australia = xtrain[xtrain['Country_Region']=='Australia'].groupby(['Date']).agg({'ConfirmedCases':['sum']}) fatalities_total_date_Australia = xtrain[xtrain['Country_Region']=='Australia'].groupby(['Date']).agg({'Fatalities':['sum']}) total_date_Australia = confirmed_total_date_Austra...
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
377
pop_italy = 60486683. pop_spain = 46749696. pop_UK = 67784927. pop_singapore = 5837230. total_date_Italy.ConfirmedCases = total_date_Italy.ConfirmedCases/pop_italy*100. total_date_Italy.Fatalities = total_date_Italy.ConfirmedCases/pop_italy*100. total_date_Spain.ConfirmedCases = total_date_Spain.ConfirmedCases/pop_spa...
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
378
# For Itally confirmed_total_date_Italy = xtrain[(xtrain['Country_Region']=='Italy') & xtrain['ConfirmedCases']!=0].groupby(['Date']).agg({'ConfirmedCases':['sum']}) fatalities_total_date_Italy = xtrain[(xtrain['Country_Region']=='Italy') & xtrain['ConfirmedCases']!=0].groupby(['Date']).agg({'Fatalities':['sum']}) tota...
No
4
12
Data_Transform
create_dataframe
8,708,118
1
A
4
0
0
0
20
23
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"]
31
B
379
# Plots plt.figure(figsize=(12,6)) plt.plot(italy_30) plt.plot(spain_30) plt.plot(UK_30) plt.plot(singapore_30) plt.legend(["Italy", "Spain", "UK", "Singapore"], loc='upper left') plt.title("COVID-19 infections from the first confirmed case", size=15) plt.xlabel("Days", size=13) plt.ylabel("Infected cases", size=13) pl...
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
380
# Check if there have any null value xtrain.isnull().sum()
No
5
39
EDA
count_missing_values
8,708,118
1
A
0
0
0
0
0
1
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, 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"}]
["Dependent Threshold Checker"]
31
B
381
# CHANGE TO PD.DATETIME xtrain.Date = pd.to_datetime(xtrain.Date, infer_datetime_format=True) xtest.Date = pd.to_datetime(xtest.Date, infer_datetime_format=True)
No
5
16
Data_Transform
data_type_conversions
8,708,118
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"]
31
A
382
# CONCISING THE TRAIN DATASET TO 18TH MARCH 2020. MIN_TEST_DATE = xtest.Date.min() xtrain = xtrain.loc[xtrain.Date < MIN_TEST_DATE, :]
No
4
14
Data_Transform
filter
8,708,118
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"]
31
A
383
# FILLING MISSING VALUES xtrain.fillna("", inplace=True) xtest.fillna("", inplace=True)
No
5
17
Data_Transform
correct_missing_values
8,708,118
1
A
0
0
0
0
0
2
ok
4
3
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 33"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": ...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "InPlace Checker"]
31
B
384
from statsmodels.tsa.arima_model import ARIMA
No
5
22
Environment
import_modules
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
385
# DROPPING COUNTRY REGION AND PROVINCE STATE xtrain.drop(['Country_Region','Province_State'],axis=1,inplace=True) xtest.drop(['Country_Region','Province_State'],axis=1,inplace=True)
No
5
10
Data_Transform
drop_column
8,708,118
1
A
0
0
0
0
0
2
ok
4
3
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 33"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": ...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Dependent Threshold Checker", "InPlace Checker"]
31
B
386
# CONVERTING DATE COLUMN TO INTEGER xtrain.loc[:, 'Date'] = xtrain.Date.dt.strftime("%m%d") xtest.loc[:, 'Date'] = xtest.Date.dt.strftime("%m%d")'
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
387
# Region wise Confirmed Cases in LinePlot sns.lineplot(data=xtrain, x="Date", y="ConfirmedCases", hue="Region") plt.show()
No
5
75
Visualization
time_series
8,708,118
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"]
31
A
388
# Region wise Fatalities in Line Plot. sns.lineplot(data=xtrain, x="Date", y="Fatalities", hue="Region") plt.show()
No
5
33
Visualization
distribution
8,708,118
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"]
31
A
389
# CREATING X AND Y for Train Dataset X1 = xtrain.drop(["ConfirmedCases", "Fatalities"], axis=1) X2 = xtrain.drop(["ConfirmedCases", "Fatalities"], axis=1) y1 = xtrain["ConfirmedCases"] y2 = xtrain["Fatalities"]
No
5
21
Data_Transform
prepare_x_and_y
8,708,118
1
A
0
0
0
0
0
4
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"]
31
B
390
# Create TEST 1 AND TEST 2 for Test dataset test_1 = xtest.copy() test_2 = xtest.copy()
No
5
12
Data_Transform
create_dataframe
8,708,118
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"]
31
A
391
for f2 in ["Region"]: me2 = MeanEncoding(f2, C=0.01 * len(X2[f2].unique())) me2.fit(X2, y2) X2 = me2.transform(X2) test_2 = me2.transform(test_2)
No
4
7
Model_Train
train_model
8,708,118
1
A
0
1
1
0
0
5
ok
11
9
[{"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, 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"}]
["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"]
31
D
392
for f1 in ["Region"]: me1 = MeanEncoding(f1, C=0.01 * len(X1[f1].unique())) me1.fit(X1, y1) X1 = me1.transform(X1) test_1 = me1.transform(test_1)
No
5
20
Data_Transform
categorify
8,708,118
1
A
0
1
1
0
0
5
ok
11
9
[{"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, 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"}]
["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"]
31
D
393
# View Test_1 test_1
No
5
53
Other
something_strange
8,708,118
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"]
31
A
394
# View Test_2 test_2
No
5
41
Debug
show_table
8,708,118
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"]
31
A
395
# Load some Basic Library import matplotlib.pyplot as plt from sklearn import model_selection import numpy as np
No
5
22
Environment
import_modules
8,708,118
1
A
0
0
0
0
0
3
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"]
31
A
396
# FUNCTION FOR COMPARING DIFFERENT REGRESSORS def algorithim_boxplot_comparison( X, y, algo_list=[], random_state=3, scoring="r2", n_splits=10 ): results = [] names = [] for algo_name, algo_model in algo_list: kfold = model_selection.KFold( shuffle=True, n_splits=n_splits, rando...
No
5
84
Other
not_enough_vertices
8,708,118
1
A
0
2
1
0
0
30
ok
6
6
[{"detector": "framework_specific", "framework": "NumPy", "name": "Inefficient Operations", "fix": "Optimize numerical operations.", "benefits": "Improves performance and reduces execution time.", "location": "Line 39"}, {"detector": "framework_specific", "framework": "NumPy", "name": "Missing Axis Specification", "fix...
C
Missing Axis Specification=medium
[{"type": "Missing Axis Specification", "severity": "medium"}]
["Dependent Threshold Checker", "Exception Handling Checker", "Inefficient Operations", "Missing function docstring", "Unit Testing Checker"]
31
C
397
# REGRESSORS lr = LinearRegression(n_jobs=-1) rfr = RandomForestRegressor(random_state=96, n_jobs=-1) gbr = GradientBoostingRegressor(random_state=96) xgbr = XGBRegressor()
No
5
82
Hyperparam_Tuning
define_search_model
8,708,118
1
A
0
0
0
0
0
4
ok
3
2
[{"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 34"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
A
no applicable ML-specific findings
[]
["Dependent Threshold Checker", "Verbose Mode Checker"]
31
A
398
df_out = pd.DataFrame({'ForecastId': [], 'ConfirmedCases': [], 'Fatalities': []}) soln = pd.DataFrame({'ForecastId': test_df.ForecastId, 'ConfirmedCases': Y_pred_CC, 'Fatalities': Y_pred_Fat}) df_out = pd.concat([df_out, soln], axis=0) df_out.ForecastId = df_out.ForecastId.astype('int')
No
3
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
399
# APPENDING THE REGRESSORS IN A LIST models = [] models.append(('lr',lr)) models.append(('rfr',rfr)) models.append(('gbr',gbr)) models.append(('xgbr',xgbr))
No
5
82
Hyperparam_Tuning
define_search_model
8,708,118
1
A
0
0
0
0
0
5
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"]
31
A
400
df_out.to_csv('submission.csv', index=False) print("Your submission was successfully saved!")'
No
5
25
Data_Export
save_to_csv
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
401
\
No
5
6
Hyperparam_Tuning
train_on_grid
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
402
def model_eval(case): state = ['Italy'] for s in state: train_ts = train[train['Province_State'] == s][:50] test_ts = train[train['Province_State'] == s][50:] a = 9999 for pdq in pdq_results: try: model = ARIMA(train_ts[case], order = pdq, dat...
No
3
48
Model_Evaluation
predict_on_test
8,706,858
1
A
2
4
9
0
10
20
ok
11
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "Magic number", "Unit Testing Checker", "Verbose Mode Checker"]
1
B
403
# 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
88
Debug
list_files
null
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
0
null
404
model_eval('ConfirmedCases')
No
5
53
Other
something_strange
8,706,858
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
1
A