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,616 | import seaborn as sns
plt.figure(figsize=(20,20))
ax=plt.subplot(221)
sns.boxplot(data=df4,x="hours",y="registered",ax=ax)
ax=plt.subplot(222)
sns.boxplot(data=df4,x="hours",y="casual",ax=ax)
ax=plt.subplot(223)
sns.boxplot(data=df4,x="hours",y="count",ax=ax) | No | 5 | 75 | Visualization | time_series | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 8 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 12 | A |
3,617 | df4["logcasual"]=np.log(df4["casual"]+1)
df4["logcasual"]=np.log(df4["casual"]+1)
df4["logcasual"]=np.log(df4["casual"]+1)
df4.head() | No | 5 | 8 | Data_Transform | feature_engineering | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,618 | df4["logregistered"]=np.log(df4["registered"]+1)
df4["logcount"]=np.log(df4["count"]+1)
df4.head() | No | 4 | 8 | Data_Transform | feature_engineering | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,619 | #inspecting hourly trend
import seaborn as sns
plt.figure(figsize=(20,20))
ax=plt.subplot(221)
sns.boxplot(data=df4,x="hours",y="logregistered",ax=ax)
ax=plt.subplot(222)
sns.boxplot(data=df4,x="hours",y="logcasual",ax=ax)
ax=plt.subplot(223)
sns.boxplot(data=df4,x="hours",y="logcount",ax=ax) | No | 5 | 75 | Visualization | time_series | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 8 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 12 | A |
3,620 | df4["day"]=df4["time"].dt.day
df4.head(25) | No | 5 | 8 | Data_Transform | feature_engineering | 1,264,566 | 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": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,621 | df4["day"]=df4["time"].dt.dayofweek
df4.head() | No | 5 | 8 | Data_Transform | feature_engineering | 1,264,566 | 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": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,622 | df4["day"]=df4["time"].dt.dayofweek
df4.head(25) | No | 4 | 8 | Data_Transform | feature_engineering | 1,264,566 | 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": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,623 | #inspecting daily trend
import seaborn as sns
plt.figure(figsize=(20,20))
ax=plt.subplot(221)
sns.boxplot(data=df4,x="day",y="logregistered",ax=ax)
ax=plt.subplot(222)
sns.boxplot(data=df4,x="day",y="logcasual",ax=ax)
ax=plt.subplot(223)
sns.boxplot(data=df4,x="day",y="logcount",ax=ax) | No | 5 | 75 | Visualization | time_series | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 8 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 12 | A |
3,624 | import seaborn as sns
plt.figure(figsize=(20,20))
ax=plt.subplot(221)
sns.boxplot(data=df4,x="day",y="registered",ax=ax)
ax=plt.subplot(222)
sns.boxplot(data=df4,x="day",y="casual",ax=ax)
ax=plt.subplot(223)
sns.boxplot(data=df4,x="day",y="count",ax=ax) | No | 5 | 75 | Visualization | time_series | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 8 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 12 | A |
3,625 | df5=df.copy()
df5.drop(["holiday","workingday","season"],axis=1,inplace=True)
df5.corr() | No | 4 | 10 | Data_Transform | drop_column | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | 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 14"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "InPlace Checker"] | 12 | A |
3,626 | df4["year"]=df4['time'].dt.year
df4.head()' | No | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,627 | plt.figure(figsize=(20,20))
ax=plt.subplot(2,2,1)
sns.boxplot(data=df4,x="year",y='registered',ax=ax)
#plt.figure(figsize=(20,20))
ax=plt.subplot(2,2,2)
sns.boxplot(data=df4,x="year",y='casual',ax=ax)
#plt.figure(figsize=(20,20))
ax=plt.subplot(2,2,3)
sns.boxplot(data=df4,x="year",y='count',ax=ax)
' | 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 |
3,628 | plt.figure(figsize=(10,10))
sns.boxplot(data=df4,x="weekend",y="casual") | No | 5 | 75 | Visualization | time_series | 1,264,566 | 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"] | 12 | A |
3,629 | df4.groupby("weekend")["datetime"].nunique() | No | 5 | 54 | EDA | count_unique_values | 1,264,566 | 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"] | 12 | A |
3,630 |
df4["month"]=df4["time"].dt.month
df4.head() | No | 4 | 8 | Data_Transform | feature_engineering | 1,264,566 | 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": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,631 | #df4.drop(["year_bins"],axis=1,inplace=True)
df4["year_bin"]="y0"
df4["year_bin"].loc[(df4["year"]==2011) & (df4["month"]<=3)]="y1"
df4["year_bin"].loc[(df4["year"]==2011) & (df4["month"]>3) & (df4["month"]<=6)]="y2"
df4["year_bin"].loc[(df4["year"]==2011) & (df4["month"]>6) & (df4["month"]<=9)]="y3"
df4["year_bin"].lo... | No | 4 | 20 | Data_Transform | categorify | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,632 | plt.figure(figsize=(20,20))
ax=plt.subplot(221)
sns.boxplot(data=df4,x="year_bin",y="casual",ax=ax)
ax=plt.subplot(222)
sns.boxplot(data=df4,x="year_bin",y="registered",ax=ax)
ax=plt.subplot(223)
sns.boxplot(data=df4,x="year_bin",y="count",ax=ax) | No | 5 | 33 | Visualization | distribution | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 7 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 12 | A |
3,633 | from sklearn.cross_validation import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn import tree | No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 0 | A |
3,634 | from sklearn.tree import DecisionTreeRegressor
l=["hours"]
X=df4[l]
Y=df4["casual"]
dtree=DecisionTreeRegressor(max_depth=3)
dtree.fit(X,Y) | No | 5 | 7 | Model_Train | train_model | 1,264,566 | 2 | B | 2 | 0 | 0 | 0 | 10 | 6 | ok | 6 | 6 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 12 | B |
3,635 | from sklearn.externals.six import StringIO
from IPython.display import Image
from sklearn.tree import export_graphviz
import graphviz
data = export_graphviz(dtree,out_file=None,
filled=True, rounded=True,
special_characters=True)
graph = graphviz.Source(data)
gr... | Yes | 4 | 22 | Environment | import_modules | 1,264,566 | 1 | A | 0 | 0 | 0 | 1 | 0 | 9 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker"] | 12 | A |
3,636 | df4["casual"].describe() | No | 5 | 40 | Debug | show_table_attributes | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,637 | l=["hours"]
X=df4[l]
Y=df4["registered"]
dtree1=DecisionTreeRegressor(max_depth=4)
dtree1.fit(X,Y) | No | 5 | 7 | Model_Train | train_model | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | ok | 6 | 6 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross Valida... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 12 | B |
3,638 | data = export_graphviz(dtree1,out_file=None,
filled=True, rounded=True,
special_characters=True)
graph = graphviz.Source(data)
graph | No | 5 | 84 | Other | not_enough_vertices | 1,264,566 | 1 | A | 0 | 0 | 0 | 1 | 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"] | 12 | A |
3,639 | df4["daycas"]="cas0"
df4["daycas"].loc[df4["hours"]<=6.5]="cas1"
df4["daycas"].loc[(df4["hours"]>6.5) & (df4["hours"]<=7.5)]="cas2"
df4["daycas"].loc[(df4["hours"]>7.5) & (df4["hours"]<=8.5)]="cas3"
df4["daycas"].loc[(df4["hours"]>8.5) & (df4["hours"]<=9.5)]="cas4"
df4["daycas"].loc[(df4["hours"]>9.5) & (df4["hours"]<=... | No | 5 | 20 | Data_Transform | categorify | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 9 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,640 | df4.groupby("daycas")["datetime"].nunique() | No | 5 | 54 | EDA | count_unique_values | 1,264,566 | 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"] | 12 | A |
3,641 | df4["dayreg"]="reg0"
df4["dayreg"].loc[df4["hours"]<=0.5]="reg1"
df4["dayreg"].loc[(df4["hours"]>0.5) & (df4["hours"]<=1.5)]="reg2"
df4["dayreg"].loc[(df4["hours"]>1.5) & (df4["hours"]<=4.5)]="reg3"
df4["dayreg"].loc[(df4["hours"]>4.5) & (df4["hours"]<=5.5)]="reg4"
df4["dayreg"].loc[(df4["hours"]>5.5) & (df4["hours"]<=... | No | 4 | 20 | Data_Transform | categorify | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 14 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,642 | df4.head()
| No | 5 | 41 | Debug | show_table | 1,264,566 | 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"] | 12 | A |
3,643 | df3["time"]=pd.to_datetime(df3["datetime"])
df3["year"]=df3['time'].dt.year
df3["month"]=df3["time"].dt.month
df3["day"]=df3["time"].dt.dayofweek
df3.head()' | No | 4 | 8 | Data_Transform | feature_engineering | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,644 | df3["year_bin"]="y0"
df3["year_bin"].loc[(df3["year"]==2011) & (df3["month"]<=3)]="y1"
df3["year_bin"].loc[(df3["year"]==2011) & (df3["month"]>3) & (df3["month"]<=6)]="y2"
df3["year_bin"].loc[(df3["year"]==2011) & (df3["month"]>6) & (df3["month"]<=9)]="y3"
df3["year_bin"].loc[(df3["year"]==2011) & (df3["month"]>9) & (d... | No | 5 | 20 | Data_Transform | categorify | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 32 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,645 | df6=df4.copy()
df6.drop(["datetime","season","time","count","registered","casual","logcount"],axis=1,inplace=True)
df6.head() | No | 4 | 10 | Data_Transform | drop_column | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | 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 14"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "InPlace Checker"] | 12 | A |
3,646 | df4["rtemp1"]=df4["temp"]+df4["atemp"]
df4["rtemp2"]=df4["temp"]-df4["atemp"]
df4["rtemp3"]=df4["temp"]*df4["atemp"]
print(df4["temp"].corr(df4["registered"]))
print(df4["rtemp1"].corr(df4["registered"]))
print(df4["rtemp2"].corr(df4["registered"]))
print(df4["rtemp3"].corr(df4["registered"]))
df3["rtemp3"]=df3["temp"]... | No | 5 | 8 | Data_Transform | feature_engineering | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 8 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 12 | A |
3,647 | df3.drop(["datetime","season","time"],axis=1,inplace=True) | No | 5 | 10 | Data_Transform | drop_column | 1,264,566 | 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 13"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "InPlace Checker"] | 12 | A |
3,648 | from sklearn.cross_validation import train_test_split
from sklearn.ensemble import RandomForestRegressor,GradientBoostingRegressor
from sklearn.metrics import mean_squared_error | No | 5 | 22 | Environment | import_modules | 1,264,566 | 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"] | 12 | A |
3,649 | df6.head()
| No | 5 | 41 | Debug | show_table | 1,264,566 | 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"] | 12 | A |
3,650 | df7=df6.logcasual
df8=df6.logregistered | No | 5 | 8 | Data_Transform | feature_engineering | 1,264,566 | 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"] | 12 | A |
3,651 | df6.drop(["logcasual",'logregistered'],axis=1,inplace=True)
' | No | 5 | 10 | Data_Transform | drop_column | null | 1 | A | 0 | null | 0 | 0 | 0 | null | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,652 | df6.drop(["atemp"],axis=1,inplace=True) | No | 5 | 10 | Data_Transform | drop_column | 1,264,566 | 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 13"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "InPlace Checker"] | 12 | A |
3,653 | df6.drop(["temp"],axis=1,inplace=True) | No | 5 | 10 | Data_Transform | drop_column | 1,264,566 | 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 13"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "InPlace Checker"] | 12 | A |
3,654 | df6.drop(["rtemp3","month"],axis=1,inplace=True)
d=pd.read_csv("../input/train.csv")
df6["temp"]=d["temp"]
var=["holiday","workingday","weekend","hours"]
for v in var:
df6[v]=df6[v].astype("category")
| No | 3 | 10 | Data_Transform | drop_column | 1,264,566 | 1 | A | 0 | 1 | 1 | 0 | 0 | 6 | ok | 4 | 4 | [{"detector": "framework_specific", "framework": "Pandas", "name": "InPlace Checker", "fix": "Assign operations to a new DataFrame variable.", "benefits": "Prevents data loss and improves code clarity.", "location": "Line 13"}, {"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker"... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker", "Hardcoded file path", "InPlace Checker"] | 12 | A |
3,655 | from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test=train_test_split(dfreg,df7,random_state=42)
rf=RandomForestRegressor(n_estimators=500)
rf.fit(x_train,y_train)
predictions=rf.predict(x_test)
mean_squared_error(y_test, predictions) | Yes | 4 | 20 | Data_Transform | categorify | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 6 | ok | 11 | 9 | [{"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, Randomness Control Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Cross-validation not detected", "severity": "low"}, {"type": "Randomness Control Checker", "severity": "low"}] | ["Dependent Threshold Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Only MSE detected for regression. Consider adding R2 score or MAE for a more comprehensive evaluation.", "Unit Testing Checker", "Verbos... | 12 | B |
3,656 | rf1=RandomForestRegressor(n_estimators=500)
rf1.fit(dfcas,df7)
rf2=RandomForestRegressor(n_estimators=500)
rf2.fit(dfreg,df8) | Yes | 4 | 49 | Model_Evaluation | compute_test_metric | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 14 | 9 | [{"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"}] | ["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"] | 12 | B |
3,657 | df6.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,658 | df3.drop(["temp","atemp"],axis=1,inplace=True) | No | 5 | 10 | Data_Transform | drop_column | 1,264,566 | 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 13"}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold ... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "InPlace Checker"] | 12 | A |
3,659 | print(df3.shape)
print(df6.shape) | No | 5 | 58 | Debug | show_shape | 1,264,566 | 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"] | 12 | A |
3,660 | newtest=df3.tail(17379-10886)
newtest.head() | No | 5 | 41 | Debug | show_table | 1,264,566 | 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"] | 12 | A |
3,661 | testdf.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,662 | newtest.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,663 | print(newtest.shape)
print(testdf.shape) | No | 5 | 58 | Debug | show_shape | 1,264,566 | 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"] | 12 | A |
3,664 | newtest.drop(["rtemp3","month"],axis=1,inplace=True)
f=pd.read_csv("../input/test.csv")
newtest['year']=newtest.year.replace({2011:0,2012:1})
newtest["temp"]=f["temp"]
var=["holiday","workingday","weekend","hours"]
for v in var:
newtest[v]=newtest[v].astype("category")
newtestreg=newtest.copy()
newtestcas=newtest.... | No | 2 | 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,665 | predictcas=rf1.predict(newtestcas)
predictcas=np.exp(predictcas)-1
predictreg=rf2.predict(newtestreg)
predictreg=np.exp(predictreg)-1
| Yes | 4 | 20 | Data_Transform | categorify | 1,264,566 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 6 | 5 | [{"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": "framework_specific", "framework":... | B | No random seed setting detected=low | [{"type": "No random seed setting detected", "severity": "low"}] | ["Dependent Threshold Checker", "Exception Handling Checker", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness.", "Unit Testing Checker"] | 12 | B |
3,666 | print(type(predictcas)) | No | 5 | 70 | Debug | show_data_types | 1,264,566 | 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"] | 12 | A |
3,667 | dfcas.head()
| No | 5 | 41 | Debug | show_table | 1,264,566 | 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"] | 12 | A |
3,668 | import os | 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 |
3,669 | df = pd.read_csv('../input/train.csv', parse_dates=[0]) | No | 5 | 45 | Data_Extraction | load_from_csv | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,670 | test = pd.read_csv('../input/test.csv', parse_dates=[0]) | No | 5 | 45 | Data_Extraction | load_from_csv | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,671 | df_all['hour'] = df['datetime'].dt.hour | No | 5 | 8 | Data_Transform | feature_engineering | 1,758,085 | 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,672 | import numpy as np | No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 0 | A |
3,673 | df_all['count'] = np.log(df_all['count'] + 1)
df_all['registered'] = np.log(df_all['registered'] + 1)
df_all['casual'] = np.log(df_all['casual'] + 1) | No | 5 | 8 | Data_Transform | feature_engineering | 1,758,085 | 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"] | 4 | A |
3,674 | df_all.shape, df.shape, test.shape | No | 5 | 58 | Debug | show_shape | 1,758,085 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 4 | A |
3,675 | df_all.shape | No | 5 | 58 | Debug | show_shape | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,676 | from fastai.imports import *
from fastai.structured import * | No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,677 | df_all.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,678 | df = df_all[~df_all['count'].isnull()]
test = df_all[df_all['count'].isnull()] | No | 5 | 13 | Data_Transform | split | 1,758,085 | 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,679 | df.shape, test.shape | No | 5 | 58 | Debug | show_shape | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,680 | train = df[df['datetimeDay'] <= 15] | No | 5 | 14 | Data_Transform | filter | 1,758,085 | 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,681 | valid = df[df['datetimeDay'] > 15] | No | 5 | 14 | Data_Transform | filter | 1,758,085 | 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,682 | train.shape, valid.shape | No | 5 | 58 | Debug | show_shape | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,683 | feats = [c for c in df.columns if c not in ['casual', 'registered', 'count']] | No | 5 | 77 | Other | define_variables | 1,758,085 | 1 | A | 0 | 1 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 4 | A |
3,684 | feats = ['season',
'holiday',
'workingday',
'weather',
'temp',
'atemp',
'humidity',
'windspeed',
'datetimeDayofweek',
'hour',
'datetimeYear'] | No | 5 | 77 | Other | define_variables | 1,758,085 | 1 | A | 0 | 0 | 0 | 0 | 0 | 11 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 4 | A |
3,685 | rf.fit(train[feats], train['count']) | No | 5 | 7 | Model_Train | train_model | 1,758,085 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | 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 | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 4 | B |
3,686 | rf.predict(valid[feats]) | No | 5 | 48 | Model_Evaluation | predict_on_test | 1,758,085 | 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": "Unit Testing... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"] | 4 | A |
3,687 | from sklearn.metrics import mean_squared_error | No | 5 | 22 | Environment | import_modules | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 0 | A |
3,688 | mean_squared_error(valid['count'], rf.predict(valid[feats])) ** (1/2) | No | 5 | 49 | Model_Evaluation | compute_test_metric | 1,758,085 | 1 | A | 0 | 0 | 0 | 1 | 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": "Unit Testing... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Exception Handling Checker", "Unit Testing Checker"] | 4 | A |
3,689 | pd.Series(rf.feature_importances_, index=feats).sort_values().plot.barh() | No | 5 | 79 | Visualization | model_coefficients | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,690 | real_test_predictions.min() | No | 2 | 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,691 | submission = pd.DataFrame({
"datetime": real_test_data_ids,
"count": [max(0, x) for x in real_test_predictions]
})
submission.head() | Yes | 3 | 41 | Debug | show_table | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,692 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
RANDOM_STATE = 31415 | No | 5 | 77 | Other | define_variables | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 5 | ok | 1 | 1 | [{"detector": "general_ml", "framework": "General ML", "name": "Magic number detected: 31415", "fix": "Not specified", "benefits": "Not specified", "location": "Line 7"}] | A | no applicable ML-specific findings | [] | ["Magic number"] | 0 | A |
3,693 | cols = df_train.columns.tolist()
cols | No | 5 | 71 | Debug | show_columns | 10,760,317 | 1 | A | 0 | 0 | 0 | 1 | 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": "framework_specific", "framework": "ScikitLear... | B | Cross Validation Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Dependent Threshold Checker"] | 5 | B |
3,694 | from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit_transform(df_train) | Yes | 4 | 7 | Model_Train | train_model | 10,760,317 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 7 | 7 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Pipeline Checker", "fix": "Use Pipelines for all scikit-learn estimators.", "benefits": "Prevents data leakage and ensures correct model evaluation.", "location": ""}, {"detector": "framework_specific", "framework": "ScikitLearn", "name": "Cross V... | D | Cross Validation Checker=low, Data Leakage Checker=high, Pipeline Checker=low | [{"type": "Cross Validation Checker", "severity": "low"}, {"type": "Data Leakage Checker", "severity": "high"}, {"type": "Pipeline Checker", "severity": "low"}] | ["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 5 | D |
3,695 | x = df_train.drop(['Cover_Type'],axis = 1)
y = df_train['Cover_Type'] | No | 5 | 21 | Data_Transform | prepare_x_and_y | 10,760,317 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | 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"] | 5 | B |
3,696 | x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.30,random_state=42) | No | 5 | 13 | Data_Transform | split | 10,760,317 | 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"] | 5 | B |
3,697 | xgb = XGBClassifier()
xgb.fit(x_train,y_train) | No | 5 | 7 | Model_Train | train_model | 10,760,317 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 5 | 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 | [{"type": "Cross Validation Checker", "severity": "low"}] | ["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker", "Verbose Mode Checker"] | 5 | B |
3,698 | predics =xgb.predict(x_test)
predics
| No | 5 | 48 | Model_Evaluation | predict_on_test | 10,760,317 | 1 | A | 0 | 0 | 0 | 1 | 0 | 2 | ok | 3 | 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": "framework_specific", "framework":... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker"] | 5 | A |
3,699 | accuracy_score(y_test,predics) | No | 5 | 49 | Model_Evaluation | compute_test_metric | 10,760,317 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 2 | 2 | [{"detector": "framework_specific", "framework": "ScikitLearn", "name": "Dependent Threshold Checker", "fix": "Use threshold-independent metrics alongside threshold-dependent ones.", "benefits": "Provides a comprehensive evaluation of model performance.", "location": ""}, {"detector": "framework_specific", "framework":... | A | no applicable ML-specific findings | [] | ["Dependent Threshold Checker", "Unit Testing Checker"] | 5 | A |
3,700 | df_test['Cover_Type'] = xgb.predict(df_test)
df_test['Cover_Type'] | No | 5 | 48 | Model_Evaluation | predict_on_test | 10,760,317 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | 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": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker", "Exception Handling Checker", "Unit Testing Checker"] | 5 | A |
3,701 | my_submission = pd.DataFrame({'Id':test_id,'Cover_Type': df_test['Cover_Type']})
my_submission.to_csv('submission.csv', index=False) | No | 5 | 25 | Data_Export | save_to_csv | 10,760,317 | 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": "Dependent Th... | A | no applicable ML-specific findings | [] | ["Column Selection Checker", "Dependent Threshold Checker"] | 5 | A |
3,702 | my_submission.to_csv(r'my_submission.csv') | No | 5 | 25 | Data_Export | save_to_csv | 10,760,317 | 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"] | 5 | A |
3,703 | # This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O... | No | 5 | 22 | Environment | import_modules | 2,133,027 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
3,704 | #Import the files and set the index
X_train = pd.read_csv('../input/train.csv')
X_test = pd.read_csv('../input/test.csv')
X_train = return_set_index(X_train)
X_test = return_set_index(X_test)
| No | 5 | 45 | Data_Extraction | load_from_csv | 2,133,027 | 1 | A | 0 | 0 | 0 | 0 | 0 | 4 | ok | 4 | 3 | [{"detector": "general_ml", "framework": "General ML", "name": "Data loading detected without size checks or batch processing. Consider using generators or batch processing for large datasets.", "fix": "Not specified", "benefits": "Not specified", "location": ""}, {"detector": "general_ml", "framework": "General ML", "... | A | no applicable ML-specific findings | [] | ["Data loading detected without size checks or batch processing. Consider using generators or batch processing for large datasets.", "Hardcoded file path", "No error handling detected in data processing. Consider adding try-except blocks or validation checks for robustness."] | 3 | A |
3,705 | #We will devide the train dataset in seasons and working days vs non working days. The idea is to group the results by hour and observe if the ratio
#mean standard deviation for each group is better or not for the overall group.
X_workingday_1 = X_train[(X_train.workingday == 1) & (X_train.season == 1)]
X_holiday_1 ... | No | 5 | 14 | Data_Transform | filter | 2,133,027 | 1 | A | 0 | 0 | 0 | 0 | 0 | 12 | ok | 1 | 1 | [{"detector": "framework_specific", "framework": "Pandas", "name": "Column Selection Checker", "fix": "Select necessary columns after importing DataFrame.", "benefits": "Clarifies data usage and improves performance.", "location": ""}] | A | no applicable ML-specific findings | [] | ["Column Selection Checker"] | 3 | A |
3,708 | X_final.reset_index(level=0, inplace=True)
X_final.to_csv('result.csv', index=False) | No | 5 | 25 | Data_Export | save_to_csv | 2,133,027 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 3 | A |
3,709 | import calendar
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from datetime import datetime
from scipy import stats
%matplotlib inline
sns.set() | No | 5 | 23 | Environment | set_options | 2,165,156 | 1 | A | 0 | null | 0 | 0 | 0 | null | invalid_python | 0 | 0 | [] | null | invalid_python | [] | [] | 9 | null |
3,710 | drop_lst = ['casual', 'registered']
df = df.drop(drop_lst, axis=1)
df.head() | No | 4 | 10 | Data_Transform | drop_column | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 3 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
3,711 | df['count'].head() | No | 5 | 41 | Debug | show_table | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
3,712 | plt.hist(df['count']); | No | 5 | 33 | Visualization | distribution | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
3,713 | count_log = np.log(df['count'])
plt.hist(count_log); | No | 5 | 33 | Visualization | distribution | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
3,714 | plt.hist(count_boxcox); | No | 5 | 33 | Visualization | distribution | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
3,715 | df['count_log'] = count_log
df['count_boxcox'] = count_boxcox | No | 5 | 8 | Data_Transform | feature_engineering | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
3,716 | df['datetime'] = pd.to_datetime(df['datetime']) | No | 5 | 16 | Data_Transform | data_type_conversions | null | 1 | A | 0 | 0 | 0 | 0 | 0 | 1 | no_ml_import | 0 | 0 | [] | null | no_ml_import | [] | [] | 0 | null |
3,717 | df['dow'] = df['datetime'].dt.dayofweek
df.head() | No | 5 | 8 | Data_Transform | feature_engineering | 2,165,156 | 1 | A | 0 | 0 | 0 | 0 | 0 | 2 | ok | 0 | 0 | [] | A | no applicable ML-specific findings | [] | [] | 9 | A |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.