Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit012df3e

Browse files
committed
new
1 parent01a6ec5 commit012df3e

File tree

6 files changed

+40
-0
lines changed

6 files changed

+40
-0
lines changed
Binary file not shown.
Binary file not shown.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
importpandasaspd
2+
importnumpyasnp
3+
fromsklearn.model_selectionimporttrain_test_split
4+
fromsklearn.preprocessingimportLabelEncoder,StandardScaler
5+
6+
defpreprocess_data(data):
7+
8+
data.fillna(method='ffill',inplace=True)
9+
10+
11+
data['Age_Tenure_Product']=data['Age']*data['Tenure']*data['NumOfProducts']
12+
data['Balance']=np.log1p(data['Balance'])
13+
14+
le=LabelEncoder()
15+
data['Geography']=le.fit_transform(data['Geography'])
16+
data['Gender']=le.fit_transform(data['Gender'])
17+
18+
19+
scaler=StandardScaler()
20+
data[['CreditScore','Age','Tenure','Balance','NumOfProducts','EstimatedSalary']]=scaler.fit_transform(data[['CreditScore','Age','Tenure','Balance','NumOfProducts','EstimatedSalary']])
21+
22+
23+
X=data.drop('Exited',axis=1)
24+
y=data['Exited']
25+
X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=42)
26+
27+
returnX_train,X_test,y_train,y_test

‎Random_Forest_project/src/kuchbhi.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
importpandasaspd
2+
fromdatapreprocimportpreprocess_data
3+
frommodel_trainingimporttrain_model
4+
frommodelevelutionimportevaluate_model
5+
6+
7+
data=pd.read_csv('Churn_Modelling.csv')
8+
9+
X_train,X_test,y_train,y_test=preprocess_data(data)
10+
11+
model=train_model(X_train,y_train)
12+
13+
evaluate_model(model,X_test,y_test)

‎Random_Forest_project/src/model_training.py

Whitespace-only changes.

‎Random_Forest_project/src/modelevelution.py

Whitespace-only changes.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp