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
4,752
predict = [] cas = LinearRegression().fit(x2_train, y2_train) pre_cas = cas.predict(x2_test) cas_poly = LinearRegression().fit(poly_x2_train, y2_train) pre_cas_poly = cas_poly.predict(poly_x2_test) rf_cas = GridSearchCV(rf, parameters, cv=5, verbose=2,scoring = scorer,n_jobs = -1) rf_cas.fit(x2_train, y2_train) pre_r...
Yes
3
7
Model_Train
train_model
10,931,352
1
A
0
0
0
0
0
11
ok
16
5
[{"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 10"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,753
print("For Random Forest Model: ") print("\\t Best Parametres for registered are: ",end='') print(rf_reg.best_params_) print("\\t Best Parametres for casual are: ",end = '') print(rf_cas.best_params_)'
No
2
2
Hyperparam_Tuning
find_best_params
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,754
predict1 = [] reg1 = LinearRegression().fit(x1_train, y1_train) pre_reg1 = reg1.predict(x1_test) reg1_poly = LinearRegression().fit(poly_x1_train, y1_train) pre_reg1_poly = reg1_poly.predict(poly_x1_test) rf1 = RandomForestRegressor(n_estimators = 200,max_depth=80,min_impurity_decrease = 0.001).fit(x1_train, y1_trai...
Yes
2
7
Model_Train
train_model
10,931,352
1
A
0
5
8
0
0
26
ok
21
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...
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"}]
["Column Selection 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"]
8
B
4,755
predict2 = [] reg2 = LinearRegression().fit(x2_train, y2_train) pre_reg2 = reg2.predict(x2_test) reg2_poly = LinearRegression().fit(poly_x2_train, y2_train) pre_reg2_poly = reg2_poly.predict(poly_x2_test) rf2 = RandomForestRegressor(n_estimators = 150,max_depth=60,min_impurity_decrease = 0.0).fit(x2_train, y2_train)...
Yes
3
7
Model_Train
train_model
10,931,352
1
A
0
5
8
0
0
26
ok
21
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...
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"}]
["Column Selection 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"]
8
B
4,756
from plotly.subplots import make_subplots name1 = ['Residual for casual without polynomial features'] *1633 name2 = ['Residual for casual with polynomial features'] *1633 name3 = ['Residual for registered without polynomial features'] *1633 name4 = ['Residual for registered with polynomial features'] *1633 dic = {'...
No
5
56
Visualization
plot_predictions
10,931,352
1
A
0
0
0
0
0
27
ok
5
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Chain Indexing", "fix": "Use single indexing or .loc[], .iloc[] methods.", "benefits": "Enhances code readability and prevents performance issues.", "location": "Line 24"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Chain Indexi...
A
no applicable ML-specific findings
[]
["Chain Indexing", "Column Selection Checker"]
8
A
4,757
rf1 = RandomForestRegressor(n_estimators = 200,max_depth=80,min_impurity_decrease = 0.001).fit(df_train_x,df_cas_train_y) rf2 = RandomForestRegressor(n_estimators = 150,max_depth=60,min_impurity_decrease = 0.0).fit(df_train_x,df_reg_train_y)
No
5
7
Model_Train
train_model
10,931,352
1
A
0
0
0
0
0
2
ok
15
8
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,758
test_file = pd.read_csv('/kaggle/input/bike-sharing-demand/test.csv')
No
5
45
Data_Extraction
load_from_csv
10,931,352
1
A
0
0
0
0
0
1
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: /kaggle/input/bike-sharing-demand/test.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
8
A
4,759
test=test_file test.describe()
No
5
40
Debug
show_table_attributes
10,931,352
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,760
test['mth'] = pd.DatetimeIndex(test['datetime']).month test['yr'] = pd.DatetimeIndex(test['datetime']).year test['dy'] = pd.DatetimeIndex(test['datetime']).day test['hr'] = pd.DatetimeIndex(test['datetime']).hour for i in test.groupby("season").count().index: s = 's' + str(i) a = [] for j in test.season: ...
No
5
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,761
pre_cas = rf1.predict(test) pre_reg = rf2.predict(test) final_predictions = pd.DataFrame(pre_cas+pre_reg,columns = ['cout']) final_predictions.describe
Yes
4
48
Model_Evaluation
predict_on_test
10,931,352
1
A
0
0
0
0
0
4
ok
5
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
8
B
4,762
final_predictions['datetime']=test_file['datetime'] final_predictions = final_predictions[['datetime','count']]
No
5
55
Data_Export
prepare_output
10,931,352
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,763
#Importing libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from scipy.stats import chi2_contingency from scipy.stats import spearmanr %matplotlib inline import itertools import os import calendar from datetime import datetime from scipy import stats from scipy.spe...
Yes
5
88
Debug
list_files
11,713,576
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
8
null
4,764
def change_to_categorical(data, max_cat=10): df = data.copy() for col in df.columns: if df[col].dtype == object or str(df[col].dtype).startswith(('int','float')): count = len(df[col].unique()) if count <= max_cat: df[col] = df[col].astype('category') return df
No
4
16
Data_Transform
data_type_conversions
11,713,576
1
A
0
5
7
0
0
8
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: change_to_categorical. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
A
4,765
def get_count_plot(x, df, ax, y=None, value_counts = None, print_percent = False): if value_counts is None: counts = df[x].value_counts().sort_index() else: counts = df[value_counts] #counts.plot.bar() #sns bars are just more colorful :P if y is None: sns.countplot(x, data=df, ax=ax) else: s...
No
4
33
Visualization
distribution
11,713,576
1
A
0
4
5
0
0
11
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: get_count_plot. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
A
4,766
def get_count_plot_for_categorical(df, n_cols = 2, y='cnt', list_cat=None, value_counts=None, print_percent=False): if list_cat is None: num_col, cat_col = get_numerical_and_categorical_col(df) else: cat_col = list_cat f, axs, n_rows = get_fig_and_axis_for_subplots(len(cat_col), n_cols) for i, col in en...
No
5
33
Visualization
distribution
11,713,576
2
B
3
3
3
0
15
9
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: get_count_plot_for_categorical. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
B
4,767
def get_target_dist_with_categorical(df, n_cols = 2, y='cnt', list_cat=None, plot_type = 'box'): if list_cat is None: num_col, cat_col = get_numerical_and_categorical_col(df) else: cat_col = list_cat f, axs, n_rows = get_fig_and_axis_for_subplots(len(cat_col), n_cols) for i, col in enumerate(cat_col): ...
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
4,768
def get_plot_for_numerical(df, n_cols = 2, plot_type='probability',list_col=None, hist=True, kde=True): if list_col is None: num_col, cat_col = get_numerical_and_categorical_col(df) else: num_col = list_col f, axs, n_rows = get_fig_and_axis_for_subplots(len(num_col), n_cols) for i, col in enumerate(...
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
4,769
# visualize correlation matrix def visualize_corr_matrix(data): numerical_col, cat_col = get_numerical_and_categorical_col(data) df = data[numerical_col] corr = df.corr()# plot the heatmap #generating masks for upper triangle so that values are not repeated mask_ut=np.triu(np.ones(corr.shape)).astyp...
No
5
80
Visualization
heatmap
11,713,576
1
A
1
1
0
0
5
6
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: visualize_corr_matrix. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 10"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
A
4,770
def remove_outliers_for_variable_by_quantiles(data, col, q1=.25, q2=.75): df = data.copy() median = df[col].median() q25, q75 = df[col].quantile([q1,q2]) iqr = q75-q25 upper_wh = q75 +1.5*iqr lower_wh = q25 - 1.5*iqr whiskers = int(np.floor(lower_wh)), int(np.ceil(upper_wh)) df.drop(df[~df[col].between(...
No
5
8
Data_Transform
feature_engineering
11,713,576
1
A
1
1
0
0
5
10
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: remove_outliers_for_variable_by_quantiles. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
A
4,771
def remove_outliers_for_variable_by_std(data, col): df = data.copy() df = df[np.abs(df[col]-df[col].mean())<=(3*df[col].std())] return df
No
5
14
Data_Transform
filter
11,713,576
1
A
0
1
0
0
0
4
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: remove_outliers_for_variable_by_std. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
A
4,772
#loop for chi square values def calculate_chi_square_values(df, alpha=.05): chi2_dict = {} numerical_col, cat_col = get_numerical_and_categorical_col(df) for i in cat_col: for j in cat_col: if i!=j and (j+' '+i) not in chi2_dict.keys(): chi2, p, dof, ex = chi2_contingenc...
No
5
47
Model_Evaluation
statistical_test
11,713,576
2
B
5
5
7
0
21
9
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: calculate_chi_square_values. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 10"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
B
4,773
def rmsle(y, y_,convertExp=True): if convertExp: y = inv_boxcox(y, fitted_lambda), y_ = inv_boxcox(y_, fitted_lambda) log1 = np.nan_to_num(np.array([np.log(v + 1) for v in y])) log2 = np.nan_to_num(np.array([np.log(v + 1) for v in y_])) calc = (log1 - log2) ** 2 return np.sqrt(n...
No
5
84
Other
not_enough_vertices
11,713,576
1
A
1
2
1
0
2
8
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: rmsle. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 9"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
8
A
4,774
def plot_prediction(test, test_pred, train, train_pred, convert_to_original_form = False): if convert_to_original_form: test = inv_boxcox(test, fitted_lambda), test_pred = inv_boxcox(test_pred, fitted_lambda) train = inv_boxcox(train, fitted_lambda), train_pred = inv_boxcox(train_pre...
No
5
56
Visualization
plot_predictions
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,775
df_hour = pd.read_csv("/kaggle/input/bike-sharing-demand/train.csv") df_test = pd.read_csv("/kaggle/input/bike-sharing-demand/test.csv")
No
5
45
Data_Extraction
load_from_csv
11,713,576
1
A
0
0
0
0
0
2
ok
3
2
[{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
8
A
4,776
df_hour.head()
No
5
41
Debug
show_table
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,777
df_hour["dteday"] = df_hour.datetime.apply(lambda x : x.split()[0]) df_hour["yr"] = df_hour.datetime.apply(lambda x : x.split()[0][:4]) df_hour['yr'] = df_hour.yr.map({'2011': 0, '2012':1}) df_hour["hr"] = df_hour.datetime.apply(lambda x : x.split()[1].split(":")[0]) df_hour["weekday"] = df_hour.dteday.apply(lambda dat...
Yes
4
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,778
#performing same on test #performing same on test df_test["dteday"] = df_test.datetime.apply(lambda x : x.split()[0]) df_test["yr"] = df_test.datetime.apply(lambda x : x.split()[0][:4]) df_test['yr'] = df_test.yr.map({'2011': 0, '2012':1}) df_test["hr"] = df_test.datetime.apply(lambda x : x.split()[1].split(":")[0]) df...
Yes
5
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,779
df_hour['cnt'] = df_hour['count'] del df_hour['count'] df_hour.shape
Yes
4
61
Data_Transform
rename_columns
11,713,576
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,780
df_hour.info()
No
5
40
Debug
show_table_attributes
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,781
df_hour.columns
No
5
71
Debug
show_columns
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,782
#Creating a copy of df to preserve original df df = df_hour.copy()
No
5
12
Data_Transform
create_dataframe
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,783
#Analysing which of these are categorical variables for col in df.columns: print('Count of unique values for ', col, ': ', len(df[col].unique()))
No
5
54
EDA
count_unique_values
11,713,576
1
A
0
1
1
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,784
'''We know maximum categories for any categorical col is 24 (for month) Hence we can use this to def function to convert variable to categorical type''' df = change_to_categorical(df, max_cat=24)
No
5
16
Data_Transform
data_type_conversions
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,785
dataTypeDf = (df.dtypes.astype(str).value_counts()).reset_index().rename(columns={"index":"variableType",0:"count"}) fig,ax = plt.subplots() fig.set_size_inches(12,5) get_count_plot('variableType',dataTypeDf, ax, 'count', value_counts='count', print_percent=True)'
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
4,786
df[get_numerical_and_categorical_col(df)[0]].describe()
No
5
40
Debug
show_table_attributes
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,787
df[get_numerical_and_categorical_col(df)[1]].describe(include='all')
No
5
40
Debug
show_table_attributes
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,788
get_plot_for_numerical(df,3)
No
3
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,789
plt.figure(figsize=(7,5)) visualize_corr_matrix(df)
No
3
80
Visualization
heatmap
11,713,576
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,790
'''Let's start creating a list which contains all the variables to be deleted. We can delete them once we're done with our exploratory analysis''' cols_to_remove = ['registered','casual','windspeed'] #besides atemp should be deleted immediately for obvious reasons! del df['atemp'] del df_test['atemp']
No
5
10
Data_Transform
drop_column
11,713,576
1
A
0
0
0
0
0
3
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,791
get_plot_for_numerical(df, 3, plot_type='box')
No
5
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,792
get_target_dist_with_categorical(df,n_cols=3)
No
5
53
Other
something_strange
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,793
get_target_dist_with_categorical(df, n_cols=2, plot_type='violin')
No
5
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,794
#Let's perform categorical test chi2 to decide which categorical columns to delete chi2_dict = calculate_chi_square_values(df) chi2_dict
No
5
47
Model_Evaluation
statistical_test
11,713,576
1
A
0
0
0
1
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,795
sns.pointplot(x='hr',y='cnt',data=df, hue='season', markers = 'x')
No
5
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,796
sns.pointplot(x='hr',y='cnt',data=df, hue='weekday', markers = 'x')
No
5
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,797
#to visualize similar plot for type of user, we would need to use melt #what melt would do, take each hour and generate rows for value variables. Next we'll use this to find mean for each hour and for each type of users hr_users_type = pd.melt(df[["hr","casual","registered"]], id_vars=['hr'], value_vars=['casual', 'reg...
Yes
2
8
Data_Transform
feature_engineering
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,798
hr_users_type_mean = pd.DataFrame(hr_users_type.groupby(["hr","variable"],sort=True)["value"].mean()).reset_index() hr_users_type_mean.head()
Yes
4
12
Data_Transform
create_dataframe
11,713,576
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,799
sns.pointplot(x=hr_users_type_mean["hr"], y=hr_users_type_mean["value"],hue=hr_users_type_mean["variable"],hue_order=["casual","registered"], data=hr_users_type_mean, join=True)
No
5
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,800
from sklearn.ensemble import RandomForestRegressor np.random.seed(42) # drop target columns df_original = df.copy() drop_cols=['cnt', 'dteday','registered','casual'] X = df.drop(drop_cols, axis = 1) # X = independent columns (potential predictors) y = df['cnt'] # y = target column (what we want to predict) # instantiat...
Yes
3
7
Model_Train
train_model
11,713,576
1
A
2
0
0
0
10
15
ok
6
5
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,801
df_cleaned = df.copy() df_cleaned.drop(cols_to_remove, axis=1, inplace=True) df_test.drop(cols_to_remove, axis=1, inplace=True, errors='ignore') df_cleaned.head()
Yes
5
10
Data_Transform
drop_column
11,713,576
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,802
df_cleaned.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
4,803
df_cleaned.drop(['cnt','cnt_log','box_cox_reverse'], axis=1, inplace=True) df_cleaned.rename(columns={'cnt_box_cox':'count_transformed'}, inplace=True)
Yes
4
10
Data_Transform
drop_column
11,713,576
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,804
sc = StandardScaler()
No
2
18
Data_Transform
normalization
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,805
target = 'count_transformed' X = df_cleaned.drop(target, axis=1) y = df_cleaned[target] seed=23 X_train, X_test, y_train, y_test = split(X, y, test_size=.3, random_state=seed)
Yes
5
13
Data_Transform
split
11,713,576
1
A
0
0
0
0
0
5
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 23", "fix": "Not specified", "benefits": "Not specified", "location": "Line 12"}]
A
no applicable ML-specific findings
[]
["Magic number"]
8
A
4,806
X_train = sc.fit_transform(X_train) X_test = sc.fit_transform(X_test)
No
4
18
Data_Transform
normalization
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,807
from sklearn.linear_model import LinearRegression,Ridge,Lasso from sklearn.model_selection import GridSearchCV, RandomizedSearchCV from sklearn.metrics import mean_squared_error as mse from sklearn import metrics # Initialize logistic regression model lr = LinearRegression() # Train the model lr.fit(X_train,y = y_tra...
Yes
3
7
Model_Train
train_model
11,713,576
1
A
0
0
0
0
0
10
ok
9
7
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,808
coeff_df = pd.DataFrame(lr.coef_, X.columns, columns=['Coefficient']) coeff_df
No
4
79
Visualization
model_coefficients
null
1
A
0
0
0
1
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,809
plot_prediction(y_test, y_pred, y_train, y_pred_train, True)
No
4
56
Visualization
plot_predictions
11,713,576
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
8
A
4,810
ridge = Ridge() ridge_param = {'max_iter':[3000], 'alpha':[.1,.03,.3,1,3,10, 30, 100,300]} rmsle_scorer = metrics.make_scorer(rmsle, greater_is_better=False) grid_ridge = GridSearchCV(ridge, ridge_param, scoring = rmsle_scorer, cv = 10) gr...
Yes
3
6
Hyperparam_Tuning
train_on_grid
11,713,576
1
A
0
0
0
0
0
13
ok
9
5
[{"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 12"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,811
fig,ax= plt.subplots() fig.set_size_inches(12,5) df = pd.DataFrame(grid_ridge.cv_results_) df["alpha"] = df["params"].apply(lambda x:x["alpha"]) df["rmsle"] = df["mean_test_score"].apply(lambda x:-x) sns.pointplot(data=df,x="alpha",y="rmsle",ax=ax)
No
5
81
Visualization
relationship
11,713,576
1
A
0
0
0
0
0
6
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}]
A
no applicable ML-specific findings
[]
["Unit Testing Checker"]
8
A
4,812
plot_prediction(y_test, y_pred_ridge, y_train, y_pred_ridge_train, True)
No
4
56
Visualization
plot_predictions
11,713,576
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
8
A
4,813
lasso = Lasso() alpha = 1/np.array([.1,.03,.3,1,3,10, 30, 100,300,1000]) lasso_param = {'max_iter':[3000], 'alpha':alpha} rmsle_scorer = metrics.make_scorer(rmsle, greater_is_better=False) random_lasso = RandomizedSearchCV(lasso, lasso_param, scoring = rmsle_scorer,...
No
3
6
Hyperparam_Tuning
train_on_grid
11,713,576
1
A
0
0
0
0
0
14
ok
8
5
[{"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 13"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
B
No random seed setting detected=low
[{"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,814
fig,ax= plt.subplots() fig.set_size_inches(12,5) df = pd.DataFrame(random_lasso.cv_results_) df["alpha"] = df["params"].apply(lambda x:x["alpha"]) df["rmsle"] = df["mean_test_score"].apply(lambda x:-x) sns.pointplot(data=df,x="alpha",y="rmsle",ax=ax)
No
5
84
Other
not_enough_vertices
11,713,576
1
A
0
0
0
0
0
6
ok
1
1
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}]
A
no applicable ML-specific findings
[]
["Unit Testing Checker"]
8
A
4,815
plot_prediction(y_test, y_pred_lasso, y_train, y_pred_lasso_train, True)
No
4
56
Visualization
plot_predictions
11,713,576
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
8
A
4,816
from sklearn.tree import DecisionTreeRegressor as dt dt_m = dt(random_state=0) dt_m.fit(X_train,y_train) y_pred_dt=dt_m.predict(X_test) y_pred_dt_train=dt_m.predict(X_train) print('RMSLE for test: ',rmsle(y_test, y_pred_dt, True)) print('RMSLE for train: ',rmsle(y_train, y_pred_dt_train, True))
Yes
4
7
Model_Train
train_model
11,713,576
1
A
1
0
0
0
5
7
ok
8
6
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,817
plot_prediction(y_test, y_pred_dt, y_train, y_pred_dt_train, True)
No
4
56
Visualization
plot_predictions
11,713,576
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
8
A
4,818
from sklearn.ensemble import RandomForestRegressor as rfr rf = rfr(n_estimators=100) rf.fit(X_train, y_train) y_pred_rf = rf.predict(X_test) y_pred_rf_train = rf.predict(X_train) print('RMSLE for test: ',rmsle(y_test, y_pred_rf, True)) print('RMSLE for train: ',rmsle(y_train, y_pred_rf_train, True))
Yes
3
7
Model_Train
train_model
11,713,576
1
A
2
0
0
0
10
7
ok
9
7
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,819
plot_prediction(y_test, y_pred_rf, y_train, y_pred_rf_train, True)
No
4
56
Visualization
plot_predictions
11,713,576
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
8
A
4,820
from sklearn.ensemble import GradientBoostingRegressor gbm = GradientBoostingRegressor(n_estimators=3000,alpha=.03) gbm.fit(X_train,y_train) y_pred_gbm = gbm.predict(X_test) y_pred_gbm_train = gbm.predict(X_train) print('RMSLE for test: ',rmsle(y_test, y_pred_gbm, True)) print('RMSLE for train: ',rmsle(y_train, y_pred_...
Yes
3
7
Model_Train
train_model
11,713,576
1
A
2
0
0
0
10
7
ok
10
7
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
B
4,821
plot_prediction(y_test, y_pred_gbm, y_train, y_pred_gbm_train, True)
No
4
56
Visualization
plot_predictions
11,713,576
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
8
A
4,822
df_test = df_test.sort_values(by='datetime') datetime_series = df_test.datetime df_test_for_model = df_test.copy() df_test_for_model.drop(['datetime'], inplace=True, axis=1) X_test_ndarry = df_test_for_model.to_numpy() final_X_test = sc.fit_transform(X_test_ndarry) final_y_pred = inv_boxcox(gbm.predict(final_X_test), f...
Yes
3
21
Data_Transform
prepare_x_and_y
11,713,576
1
A
0
0
0
0
0
7
ok
9
8
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
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"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
8
D
4,823
final_y_pred.shape, datetime_series.shape
No
5
58
Debug
show_shape
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,824
submission = pd.DataFrame({'datetime':datetime_series, 'count':np.round(final_y_pred)})
No
5
55
Data_Export
prepare_output
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,825
submission_rf = pd.DataFrame({'datetime':datetime_series, 'count':final_y_pred_rf})
No
5
12
Data_Transform
create_dataframe
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,826
sns.distplot(final_y_pred, hist=True, kde=True, color = 'darkblue', hist_kws={'edgecolor':'black'}, kde_kws={'linewidth': 4})
No
5
33
Visualization
distribution
11,713,576
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,827
#Just to avoid any missing values submission[submission['count'].isna()]
No
4
39
EDA
count_missing_values
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,828
#let's see values around it to fill these #intuition knn submission.iloc[721],submission.iloc[720],submission.iloc[719]
No
4
41
Debug
show_table
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,829
#By this and also by our initial analysis, afternoon is not a preferable time to ride bike submission.fillna(0, inplace=True)
No
5
17
Data_Transform
correct_missing_values
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,830
submission.iloc[725],submission.iloc[726],submission.iloc[727]
No
4
41
Debug
show_table
11,713,576
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,831
submission.to_csv('bike_predictions_rounded.csv', index=False) submission.to_csv('bike_predictions_random_forest.csv', index=False)
No
5
25
Data_Export
save_to_csv
11,713,576
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
8
A
4,832
import pandas as pd import calendar import numpy as np import seaborn as sns import matplotlib.pyplot as plt from scipy.special import boxcox, inv_boxcox from datetime import datetime from numpy import arange from pandas import read_csv from sklearn.linear_model import Ridge,Lasso from sklearn.model_selection import Re...
Yes
4
45
Data_Extraction
load_from_csv
12,980,177
1
A
0
0
0
0
0
16
ok
6
3
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Hardcoded file path", "Import Checker"]
10
B
4,833
#Fig Will show count distribution sns.distplot(train_df['count']) plt.show()
No
5
33
Visualization
distribution
12,980,177
1
A
0
0
0
0
0
2
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Import Checker"]
10
A
4,834
#Fig Will show count distribution post log transformation train_df['count']=train_df['count'].apply(lambda x:np.log(x)) sns.distplot(train_df['count']) plt.show() print (train_df['count']) train_df.shape
Yes
4
33
Visualization
distribution
12,980,177
1
A
0
0
0
0
0
5
ok
4
3
[{"detector": "framework_specific", "framework": "General", "name": "Import Checker", "fix": "Use standard naming conventions for imported modules.", "benefits": "Improves code readability and maintainability.", "location": "Line 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker", "Import Checker"]
10
B
4,835
#Visualize Count wrt categorical variables cat_names=['season', 'holiday', 'workingday', 'weather'] i=0 for name in cat_names: i=i+1 plt.subplot(2,2,i) sns.countplot(name,data=train_df) plt.show()
No
5
33
Visualization
distribution
12,980,177
1
A
0
1
1
0
0
7
ok
2
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Import Checker"]
10
A
4,836
#Visualize data wrt continous variables. cont_names=['temp','atemp','humidity','windspeed'] i=0 for name in cont_names: i=i+1 plt.subplot(2,2,i) sns.boxplot(name,data=train_df) plt.show() #Windspeed seems to be skewed
No
5
33
Visualization
distribution
12,980,177
1
A
0
1
1
0
0
7
ok
2
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Import Checker"]
10
A
4,837
#Splitting out Datetime attribute in dataframe and dropping unwanted variables as per before analysis new_df=train_df.copy(deep=True) new_df['day']=new_df['datetime'].apply(lambda dateString : calendar.day_name[datetime.strptime(dateString,"%Y-%m-%d %H:%M:%S").weekday()]) new_df['datetime'] = pd.to_datetime(new_df['dat...
Yes
3
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
4,838
#adding dummy varibles to categorical variables dropping the souce columns weather_df=pd.get_dummies(final_df['weather'],prefix='w',drop_first=True) yr_df=pd.get_dummies(final_df['year'],prefix='y',drop_first=True) month_df=pd.get_dummies(final_df['month'],prefix='m',drop_first=True) hour_df=pd.get_dummies(final_df['ho...
Yes
4
20
Data_Transform
categorify
12,980,177
1
A
0
0
0
0
0
13
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Import Checker"]
10
A
4,839
print(final_df.columns.to_series().groupby(final_df.dtypes).groups) final_df.head(5)
Yes
4
41
Debug
show_table
12,980,177
1
A
0
0
0
0
0
2
ok
2
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Import Checker"]
10
A
4,840
#Initializing training set X=final_df.iloc[:,final_df.columns!='count'].values Y=final_df.iloc[:,5].values
No
5
21
Data_Transform
prepare_x_and_y
12,980,177
1
A
0
0
0
0
0
2
ok
2
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Import Checker"]
10
A
4,841
#Ridge Regression Implementation 10 Folds # define model model = Ridge() # define model evaluation method cv = RepeatedKFold(n_splits=10, n_repeats=3, random_state=1) # define grid grid = dict() grid['alpha'] = arange(0, 1, 0.01) # define search search = GridSearchCV(model, grid, scoring='neg_mean_squared_error', cv=cv...
Yes
5
6
Hyperparam_Tuning
train_on_grid
12,980,177
1
A
1
0
0
0
5
8
ok
8
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Import Checker", "Unit Testing Checker", "Verbose Mode Checker"]
10
A
4,842
#Lasso Regression Implementation 10 Folds # define model model = Lasso() # define model evaluation method cv = RepeatedKFold(n_splits=10, n_repeats=3, random_state=1) # define grid grid = dict() grid['alpha'] = arange(0, 1, 0.01) # define search search = GridSearchCV(model, grid, scoring='neg_mean_squared_error', cv=cv...
Yes
5
6
Hyperparam_Tuning
train_on_grid
12,980,177
1
A
1
0
0
0
5
8
ok
8
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Import Checker", "Unit Testing Checker", "Verbose Mode Checker"]
10
A
4,843
#Decision TreeImplementation 10 Folds cv = RepeatedKFold(n_splits=10, n_repeats=3, random_state=1) dtm = DecisionTreeRegressor(random_state=42) param_grid = {"criterion": ["mse", "mae"], } search = GridSearchCV(dtm,param_grid, scoring='neg_mean_squared_error', cv=cv) results = search.fit(X, Y) # summariz...
Yes
4
6
Hyperparam_Tuning
train_on_grid
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,844
#Decision Tree with Pruning with 10 Folds cv = RepeatedKFold(n_splits=10, n_repeats=3, random_state=1) dtm = DecisionTreeRegressor(random_state=42) param_grid = {"criterion": ["mse", "mae"], "max_depth": [2, 6, 8], } search = GridSearchCV(dtm,param_grid, scoring='neg_mean_squared_error', cv=...
Yes
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
4,845
grid = dict() grid['n_estimators'] = [1000] grid['max_depth'] = [125,150,175] cv = RepeatedKFold(n_splits=10, n_repeats=3, random_state=1) model = RandomForestRegressor() search = GridSearchCV(model,param_grid=grid, scoring='neg_mean_squared_error', cv=cv) results = search.fit(X, Y) # summarize print('MSE (NEGATIVE): ...
Yes
4
6
Hyperparam_Tuning
train_on_grid
12,980,177
1
A
1
0
0
0
5
9
ok
10
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
B
Randomness Control Checker=low
[{"type": "Randomness Control Checker", "severity": "low"}]
["Column Selection Checker", "Exception Handling Checker", "Import Checker", "Unit Testing Checker", "Verbose Mode Checker"]
10
B
4,846
def grid_search(): from sklearn.ensemble import GradientBoostingRegressor print ('lets go') model = GradientBoostingRegressor() # define the grid of values to search grid = dict() grid['n_estimators'] = [4000] grid['learning_rate'] = [ 0.001, 0.01, 0.1] grid['max_depth'] = [4] cv =...
Yes
5
6
Hyperparam_Tuning
train_on_grid
12,980,177
1
A
3
1
0
0
15
16
ok
9
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Import Checker", "Unit Testing Checker", "Verbose Mode Checker"]
10
A
4,847
from sklearn.ensemble import GradientBoostingRegressor rgr=GradientBoostingRegressor(learning_rate=0.1,n_estimators=4000, max_depth=4) rgr.fit(X,Y)
Yes
5
7
Model_Train
train_model
12,980,177
2
B
1
0
0
0
5
3
ok
7
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 3"}, {"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"]
10
B
4,848
test_df=pd.read_csv('/kaggle/input/bike-sharing-demand/test.csv') test_df['day']=test_df['datetime'].apply(lambda dateString : calendar.day_name[datetime.strptime(dateString,"%Y-%m-%d %H:%M:%S").weekday()]) test_df['datetime']=pd.to_datetime(test_df['datetime'], format='%Y-%m-%d %H:%M:%S') test_df['month']=test_df['dat...
Yes
3
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
4,849
temp=pd.read_csv('../input/bike-sharing-demand/sampleSubmission.csv') X_test=test_df.iloc[:,:].values y_output=rgr.predict(X_test) y_output op=pd.DataFrame({'count':np.exp(y_output)}) op['datetime']=temp['datetime'] op.to_csv('finalSubmission.csv', index=False)
Yes
3
25
Data_Export
save_to_csv
12,980,177
1
A
0
0
0
1
0
7
ok
7
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 3"}, {"detector": "framework_specific", "framework": "General", "name": "Import Checker", ...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Exception Handling Checker", "Hardcoded file path", "Import Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"]
10
A
4,850
# This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load # import numpy as np # linear algebra # import pandas as pd # data processing, CSV file I/O...
No
5
88
Debug
list_files
null
1
A
1
2
3
0
5
4
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
4,851
import pandas as pd import numpy as np import seaborn as sns from scipy import stats from datetime import datetime import matplotlib.pyplot as plt %matplotlib inline
No
5
23
Environment
set_options
13,074,892
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
6
null