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
3,818
sns.barplot(data=train, x="datetime-second", y="count")
No
5
33
Visualization
distribution
2,719,562
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
3,819
# Integer String . train["datetime-year_month"] = train["datetime-year"].astype(str) + "-" + train["datetime-month"].astype(str) print(train.shape) train.info()'
Yes
3
40
Debug
show_table_attributes
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,820
train[["datetime-year", "datetime-month", "datetime-year_month"]]
No
5
41
Debug
show_table
2,719,562
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
3,821
sns.barplot(data=train, x="datetime-year_month", y="count")
No
5
33
Visualization
distribution
2,719,562
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
3,822
# ! import matplotlib.pyplot as plt plt.figure(figsize=(24,4)) sns.barplot(data=train, x="datetime-year_month", y="count")'
Yes
5
33
Visualization
distribution
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,823
plt.figure(figsize=(24,4)) sns.pointplot(data=train, x="datetime-hour", y="count")
No
5
33
Visualization
distribution
2,719,562
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
3,824
plt.figure(figsize=(24,4)) sns.pointplot(data=train, x="datetime-hour", y="count", hue="workingday")
No
5
75
Visualization
time_series
2,719,562
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
3,825
plt.figure(figsize=(24,4)) sns.pointplot(data=train, x="datetime-hour", y="count", hue="datetime-dayofweek")
No
5
33
Visualization
distribution
2,719,562
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
3
A
3,826
# x_train . x_train = train[feature_names] # x_train . print(x_train.shape) # x_test 5 . x_train.head()'
Yes
4
41
Debug
show_table
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,827
# x_test . x_test = test[feature_names] # x_test . print(x_test.shape) # x_test 5 . x_test.head()'
Yes
4
41
Debug
show_table
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,828
# . label_name = "count" y_train = train[label_name] print(y_train.shape) y_train.head()'
Yes
4
58
Debug
show_shape
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,830
from sklearn.ensemble import RandomForestRegressor model = RandomForestRegressor() model
Yes
5
4
Model_Train
choose_model_class
2,719,562
3
C
2
0
0
1
10
3
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Randomness Control Checker", "fix": "Set random_state in estimators for reproducibility.", "benefits": "Ensures reproducible results and consistent model behaviour.", "location": "Line 6"}, {"detector": "framework_specific", "framework": "ScikitLe...
B
Randomness Control Checker=low
[{"type": "Randomness Control Checker", "severity": "low"}]
["Verbose Mode Checker"]
3
C
3,831
from sklearn.model_selection import cross_val_predict y_predict = cross_val_predict(model, x_train, y_train, cv=20) print(y_predict.shape) y_predict
Yes
4
27
Model_Train
predict_on_train
2,719,562
1
A
0
0
0
1
0
4
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
3
A
3,832
score = abs(y_train - y_predict).mean() f"score(Mean Absolute Error)={score:.6f}"
No
5
28
Model_Train
compute_train_metric
2,719,562
1
A
0
0
0
0
0
2
ok
3
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker"]
3
B
3,833
# . model.fit(x_train, y_train)'
No
5
7
Model_Train
train_model
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,834
# x_test . predictions = model.predict(x_test) # array . predictions'
No
5
48
Model_Evaluation
predict_on_test
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,835
# predictions[:5]'
No
3
41
Debug
show_table
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,836
submit = pd.read_csv("../input/sampleSubmission.csv") print(submit.shape) submit.head()
Yes
3
45
Data_Extraction
load_from_csv
2,719,562
1
A
0
0
0
0
0
3
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/sampleSubmission.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 4"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
3
A
3,837
submit["count"] = predictions print(submit.shape) submit.head()
Yes
3
41
Debug
show_table
2,719,562
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"]
3
A
3,838
submit.to_csv("baseline-script.csv", index=False) pd.read_csv("baseline-script.csv").head()
Yes
4
25
Data_Export
save_to_csv
2,719,562
1
A
0
0
0
0
0
2
ok
1
1
[{"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": ""}]
A
no applicable ML-specific findings
[]
["No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
3
A
3,839
df_train = pd.read_csv('../input/train.csv') df_train.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,840
dtIdx = pd.DatetimeIndex(df_train['datetime'])
No
5
16
Data_Transform
data_type_conversions
2,874,959
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"]
9
A
3,841
df_train['hour'] = dtIdx.hour df_train['dayofweek'] = dtIdx.dayofweek df_train['month'] = dtIdx.month df_origin = df_train
No
4
16
Data_Transform
data_type_conversions
2,874,959
1
A
0
0
0
0
0
4
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
9
A
3,842
df_train = df_train.drop(['casual', 'registered', 'datetime'], axis = 1) df_train.head()
Yes
5
10
Data_Transform
drop_column
2,874,959
1
A
0
0
0
0
0
2
ok
3
3
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}]
[]
9
B
3,843
df_train_data = df_train.drop('count', axis=1)
No
5
10
Data_Transform
drop_column
2,874,959
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"}]
[]
9
B
3,844
df_train_target = df_train['count']
No
2
13
Data_Transform
split
2,874,959
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"]
9
A
3,845
df_train_target.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
3,846
from sklearn import linear_model from sklearn import svm from sklearn.ensemble import RandomForestRegressor from sklearn import model_selection
No
5
22
Environment
import_modules
2,874,959
1
A
0
0
0
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,847
ms = model_selection.ShuffleSplit(n_splits=3, test_size=0.2, random_state=0)
No
5
13
Data_Transform
split
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,851
df_train_data.head()
No
5
41
Debug
show_table
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,854
X_train, X_test, y_train, y_test = model_selection.\\ train_test_split(df_train_data, df_train_target, test_size = 0.2, random_state=0)'
No
5
13
Data_Transform
split
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,855
\
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
3,856
import matplotlib.pyplot as plt from sklearn.model_selection import learning_curve from sklearn.model_selection import ShuffleSplit def plot_learning_curve(estimator, title, X, y, ylim=None, cv=None, n_jobs=None, train_sizes=np.linspace(.1, 1.0, 5)): """ Generate a simple plot of the te...
Yes
4
35
Visualization
learning_history
null
1
A
1
2
1
0
5
29
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"]
0
A
3,858
df_origin.columns
No
5
71
Debug
show_columns
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,859
df_origin.groupby('windspeed').mean().plot(y='count', marker='o')
No
3
33
Visualization
distribution
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,860
df_origin.groupby('humidity').mean().plot(y='count', marker='o')
No
4
33
Visualization
distribution
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,861
d = df_origin.groupby('humidity')
No
5
60
Data_Transform
groupby
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,862
corr = df_origin[['temp','weather','windspeed','dayofweek', 'month', 'hour','count']].corr() corr
No
5
40
Debug
show_table_attributes
2,874,959
1
A
0
0
0
1
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,863
import matplotlib.pyplot as plt plt.figure() plt.matshow(corr) plt.colorbar() plt.show()
Yes
5
80
Visualization
heatmap
2,874,959
1
A
0
0
0
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,864
df_test = pd.read_csv('../input/test.csv') df_test.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,865
df_sample = pd.read_csv('../input/sampleSubmission.csv') df_sample.head()
Yes
4
45
Data_Extraction
load_from_csv
2,874,959
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Hardcoded file path detected: ../input/sampleSubmission.csv. Consider using configuration files or environment variables.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 10"}]
A
no applicable ML-specific findings
[]
["Hardcoded file path"]
9
A
3,866
df_test['hour'] = pd.DatetimeIndex(df_test['datetime']).hour df_test['dayofweek'] = pd.DatetimeIndex(df_test['datetime']).dayofweek df_test['month'] = pd.DatetimeIndex(df_test['datetime']).month df_test_data = df_test.drop(['datetime'], axis=1) df_test_data.head()
Yes
4
8
Data_Transform
feature_engineering
2,874,959
1
A
0
0
0
0
0
5
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
9
A
3,867
score = rfr.score(df_train_data, df_train_target)
No
5
28
Model_Train
compute_train_metric
2,874,959
1
A
0
0
0
0
0
1
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"]
9
A
3,868
print("score: %.3f"%score)
No
5
84
Other
not_enough_vertices
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,869
df_sample.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
3,871
df_sample.info()
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,872
df_sample.to_csv('submission.csv', index=False)
No
5
25
Data_Export
save_to_csv
2,874,959
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,873
df_demo = pd.read_csv('submission.csv') df_demo.head()
No
4
45
Data_Extraction
load_from_csv
2,874,959
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
9
A
3,874
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os print(os.listdir("../input")) import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import datetime from sklearn import datasets, linear_model from sklearn.metrics...
Yes
3
45
Data_Extraction
load_from_csv
3,335,717
1
A
0
null
0
0
0
null
invalid_python
0
0
[]
null
invalid_python
[]
[]
7
null
3,875
print(test.head(5))
No
5
41
Debug
show_table
3,335,717
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
3,876
# Extract hours from datetime data['datetime'] = pd.to_datetime(data['datetime']) data['hour'] = data['datetime'].dt.hour data['month'] = data['datetime'].dt.month test['datetime'] = pd.to_datetime(test['datetime']) test['hour'] = data['datetime'].dt.hour test['month'] = data['datetime'].dt.month data['season'] = dat...
No
3
16
Data_Transform
data_type_conversions
3,335,717
1
A
0
0
0
0
0
19
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
3,877
data = data.drop(['atemp', 'casual', 'registered', 'windspeed'], axis=1) test = test.drop(['atemp','windspeed'], axis=1)
No
5
10
Data_Transform
drop_column
3,335,717
1
A
0
0
0
0
0
2
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
7
A
3,878
test.head(2)
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
3,879
import math data['count'] = data['count'].transform(lambda x: math.log(x))
Yes
5
8
Data_Transform
feature_engineering
3,335,717
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Unit Testing Checker", "fix": "Write unit tests for data processing and model components.", "benefits": "Ensures code reliability and prevents bugs.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Excepti...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "Unit Testing Checker"]
7
A
3,880
data = data.drop(['datetime'], axis=1) data_dummy = data #test = test.drop(['datetime'], axis=1) test_dummy = test def dummify_dataset(df, column): df = pd.concat([df, pd.get_dummies(df[column], prefix=column, drop_first=True)],axis=1) df = df.drop([column], axis=1) return df columns_to_dummify = ...
Yes
5
20
Data_Transform
categorify
3,335,717
1
A
1
2
1
0
5
12
ok
1
1
[{"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for function: dummify_dataset. Consider adding documentation for parameters and return values.", "fix": "Not specified", "benefits": "Not specified", "location": "Line 14"}]
A
no applicable ML-specific findings
[]
["Missing function docstring"]
7
A
3,881
from sklearn.model_selection import train_test_split y = data_dummy['count'] X = data_dummy.drop(['count'], axis=1) X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.33, random_state=42)
Yes
4
21
Data_Transform
prepare_x_and_y
3,335,717
1
A
0
0
0
0
0
4
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"}]
[]
7
B
3,882
from sklearn.tree import DecisionTreeRegressor from sklearn.linear_model import LinearRegression, Ridge, HuberRegressor, ElasticNetCV from sklearn.metrics import mean_squared_log_error from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.ensemble import BaggingRegr...
Yes
5
7
Model_Train
train_model
null
1
A
2
0
0
0
10
8
ok
4
4
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"]
0
B
3,883
test_with_datetime = pd.read_csv("../input/test.csv") test_dummy = test_dummy.drop(['datetime'], axis=1) test_predictions = etr.predict(test_dummy)'
Yes
3
48
Model_Evaluation
predict_on_test
null
1
A
0
null
0
0
0
null
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,884
predictions = np.exp(test_predictions ) submission = pd.DataFrame({ 'datetime': test.datetime.values, 'count': predictions }) submission.to_csv("my_submission_10.csv", index=False)'
Yes
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
3,885
train = pd.read_csv('../input/train.csv') train.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,886
test = pd.read_csv('../input/test.csv') test.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,887
train = pd.read_csv("../input/train.csv", parse_dates = ["datetime"]) test = pd.read_csv("../input/test.csv", parse_dates = ["datetime"])
No
5
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,888
train.dtypes
No
5
70
Debug
show_data_types
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,889
train["year"] = train["datetime"].dt.year train["hour"] = train["datetime"].dt.hour train["dayofweek"] = train["datetime"].dt.dayofweek test["year"] = test["datetime"].dt.year test["hour"] = test["datetime"].dt.hour test["dayofweek"] = test["datetime"].dt.dayofweek
No
5
8
Data_Transform
feature_engineering
null
1
A
0
0
0
0
0
6
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,890
train.drop(["datetime", "windspeed", "casual", "registered", "count"], 1, inplace=True) test.drop(["datetime", "windspeed"], 1, inplace=True)
No
5
10
Data_Transform
drop_column
3,475,398
1
A
0
0
0
0
0
2
ok
3
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 4"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["InPlace Checker"]
3
B
3,891
from sklearn.ensemble import RandomForestRegressor rf = RandomForestRegressor(n_estimators=100) rf.fit(train,y_train) preds = rf.predict(test)
Yes
4
7
Model_Train
train_model
3,475,398
2
B
2
0
0
0
10
4
ok
10
8
[{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Checker", "fix": "Implement cross-validation techniques for robust model evaluation.", "benefits": "Enhances model performance and reduces overfitting.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLear...
B
Cross Validation Checker=low, Cross-validation not detected=low, No random seed setting detected=low, Randomness Control Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "No random seed setting detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
3
B
3,892
submission = pd.read_csv('../input/sampleSubmission.csv') submission.head()
Yes
4
45
Data_Extraction
load_from_csv
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,893
submission["count"] = np.expm1(preds) submission.head()
Yes
5
55
Data_Export
prepare_output
null
1
A
0
0
0
0
0
2
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,894
submission.to_csv("allrf.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
3,895
sample=pd.read_csv('../input/sampleSubmission.csv') train_df=pd.read_csv('../input/train.csv') test_df=pd.read_csv('../input/test.csv')
No
5
45
Data_Extraction
load_from_csv
3,652,538
1
A
0
0
0
0
0
3
ok
4
2
[{"detector": "general_ml", "framework": "General ML", "name": "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Har...
A
no applicable ML-specific findings
[]
["Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."]
4
A
3,896
sample.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
3,897
train_df.nunique()
No
5
54
EDA
count_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,898
test_df.nunique()
No
5
54
EDA
count_unique_values
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,899
train_df.describe()
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,900
season_df=train_df.groupby('season')
No
5
60
Data_Transform
groupby
3,652,538
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"}]
[]
4
B
3,901
season_df.head()
No
5
41
Debug
show_table
3,652,538
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,902
train_df['hour']=hour train_df['day']=day train_df['month']=month train_df['year']=year
No
2
16
Data_Transform
data_type_conversions
3,652,538
1
A
0
0
0
0
0
4
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
4
A
3,903
hour=[] day=[] month=[] year=[] for row in test_df['datetime']: date_hour=row.split() date=date_hour[0] hour_row=date_hour[1] hour.append(hour_row.split(':')[0]) date=date.split('-') day.append(date[2]) month.append(date[1]) year.append(date[0]) test_df['hour']=hour test_df['day']=day te...
No
5
8
Data_Transform
feature_engineering
3,652,538
1
A
0
1
1
0
0
17
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"]
4
A
3,904
datetime=['hour','day','month','year'] for time in datetime: train_df[time]=train_df[time].astype(int) test_df[time]=test_df[time].astype(int)
No
4
16
Data_Transform
data_type_conversions
3,652,538
1
A
0
1
1
0
0
4
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
4
B
3,905
#Continous Features Analysis for i in range(len(cont_feat)-1): for j in range(i+1,len(cont_feat)): sns.jointplot(cont_feat[i],cont_feat[j],data=train_df) plt.title('{} relation with {}'.format(cont_feat[i],cont_feat[j])) plt.show()
No
5
33
Visualization
distribution
3,652,538
1
A
0
2
3
0
0
5
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
4
A
3,906
#Categorical feature analysis for cat in cat_feat: sns.barplot(x=cat,y='count',data=train_df,estimator=sum) plt.title('{} vs total_rent'.format(cat)) plt.show()
No
4
81
Visualization
relationship
3,652,538
1
A
0
1
1
0
0
4
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,907
climate=['temp','humidity','windspeed'] for clim in climate: sns.swarmplot(x='hour',y=clim,hue='season',data=train_df) plt.title('{} vs {}'.format('hour',clim)) plt.show()
No
5
33
Visualization
distribution
3,652,538
1
A
0
1
1
0
0
5
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,908
sns.distplot(train_df['count']) train_df['count']=train_df['count'].apply(lambda x:np.log(x))
No
4
33
Visualization
distribution
3,652,538
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
4
B
3,909
sns.heatmap(train_df.corr())
No
5
80
Visualization
heatmap
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,910
train_df=pd.DataFrame(train_df)
No
5
12
Data_Transform
create_dataframe
3,652,538
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,911
train_df.set_index('datetime',inplace=True)
No
5
61
Data_Transform
rename_columns
3,652,538
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"}]
[]
4
B
3,912
test_df.set_index('datetime',inplace=True)
No
4
61
Data_Transform
rename_columns
3,652,538
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A
3,913
train_df.drop(columns=['casual','registered'],axis=1,inplace=True)
No
4
61
Data_Transform
rename_columns
3,652,538
1
A
0
0
0
0
0
1
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 5"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Validation Chec...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["InPlace Checker"]
4
B
3,914
weather_df=pd.get_dummies(train_df['weather'],prefix='weather') yr_df=pd.get_dummies(train_df['year'],prefix='year') month_df=pd.get_dummies(train_df['month'],prefix='month') hour_df=pd.get_dummies(train_df['hour'],prefix='hour') season_df=pd.get_dummies(train_df['season'],prefix='season') train_df=train_df.join(weathe...
No
4
20
Data_Transform
categorify
3,652,538
1
A
0
0
0
0
0
20
ok
4
4
[{"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"]
4
B
3,915
train_df.drop(columns=['season','hour','month','year','weather'],axis=1,inplace=True) test_df.drop(columns=['season','hour','month','year','weather'],axis=1,inplace=True)
No
5
10
Data_Transform
drop_column
3,652,538
1
A
0
0
0
0
0
2
ok
3
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 5"}, {"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["InPlace Checker"]
4
B
3,916
def rmlse(predicted,actual): sum_val=0 for i in range(len(predicted)): sum_val+=(np.log(predicted[i]+1)-np.log(actual[i]+1))**2 return (sum_val/len(predicted))**(0.5)
No
5
84
Other
not_enough_vertices
3,652,538
1
A
0
2
1
0
0
5
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "general_ml", "framework": "General ML", "name": "Missing docstring for...
A
no applicable ML-specific findings
[]
["Column Selection Checker", "Missing function docstring"]
4
A
3,917
X=train_df.drop(columns='count',axis=1) y=train_df['count']
No
5
21
Data_Transform
prepare_x_and_y
3,652,538
1
A
0
0
0
0
0
2
ok
2
2
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida...
B
Cross Validation Checker=low
[{"type": "Cross Validation Checker", "severity": "low"}]
["Column Selection Checker"]
4
B
3,918
X.info()
No
5
40
Debug
show_table_attributes
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,919
from xgboost import XGBRegressor from sklearn.model_selection import train_test_split from sklearn.model_selection import GridSearchCV X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.33,random_state=42) ''' param_test1 = { 'max_depth':range(3,10,2), 'min_child_weight':range(1,6,2) } ''' ''' param_test2...
No
4
6
Hyperparam_Tuning
train_on_grid
3,652,538
1
A
4
0
0
0
20
36
ok
7
4
[{"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 33"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": ...
A
no applicable ML-specific findings
[]
["Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
4
A
3,920
y_test
Yes
5
41
Debug
show_table
null
1
A
0
0
0
1
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,921
import xgboost as xgb xgr=xgb.XGBRegressor(learning_rate =0.1, n_estimators=1000, max_depth=9, min_child_weight=4, gamma=0.125, subsample=1, colsample_bytree=0.8) xgr.fit(train_df.drop(columns='count',axis=1),train_df['count']) y_predict=xgr.predict(test_df)
No
4
7
Model_Train
train_model
3,652,538
1
A
0
0
0
0
0
5
ok
9
8
[{"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", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker", "Verbose Mode Checker"]
4
B
3,922
test_df['count']=np.exp(y_predict)
Yes
5
8
Data_Transform
feature_engineering
3,652,538
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"]
4
A
3,923
result=pd.DataFrame()
No
5
12
Data_Transform
create_dataframe
null
1
A
0
0
0
0
0
1
no_ml_import
0
0
[]
null
no_ml_import
[]
[]
0
null
3,924
result['datetime']=test_df['datetime'] result['count']=test_df['count']
No
5
55
Data_Export
prepare_output
3,652,538
1
A
0
0
0
0
0
2
ok
1
1
[{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}]
A
no applicable ML-specific findings
[]
["Column Selection Checker"]
4
A
3,925
result.to_csv('output.csv',index=False)
No
5
25
Data_Export
save_to_csv
3,652,538
1
A
0
0
0
0
0
1
ok
0
0
[]
A
no applicable ML-specific findings
[]
[]
4
A