- Download and install the GPG command line tools for your operating system. We generally recommend installing the latest version for your operating system.
- Open Git Bash.
- Generate a GPG key pair. If you are not on version 2.1.17 or greater then
gpg --default-new-key-algo rsa4096 --gen-key
- Enter your user ID information.
- Type a secure passphrase. This is a must.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import pandas as pd | |
from sklearn.preprocessing import LabelEncoder | |
from sklearn.model_selection import train_test_split | |
from sklearn.metrics import accuracy_score,f1_score | |
from pymlpipe.tabular import PyMLPipe | |
df=pd.read_csv("train.csv") | |
encoders=["area_code","state","international_plan","voice_mail_plan","churn"] | |
for i in encoders: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
[ | |
42.0, | |
120.0, | |
1.0, | |
0.0, | |
0.0, | |
0.0, | |
185.7, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with mlp.run(): | |
mlp.register_artifact("churndata.csv",df) | |
mlp.log_params({ | |
"lr":0.01, | |
"optimizer":"SGD", | |
"loss_fuction":"BCEloss" | |
}) | |
for epoch in range(epochs): | |
loss_batch=0 | |
for batch in range(1000,5000,1000): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mlp=PyMLPipe() | |
mlp.set_experiment("Pytorch") | |
mlp.set_version(0.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def validate(model,testx,testy): | |
prediction=model(testx) | |
prediction=torch.where(prediction>.5,1,0) | |
accu=accuracy_score(prediction.detach().numpy(),test_y.unsqueeze(1).detach().numpy()) | |
f1=f1_score(prediction.detach().numpy(),test_y.unsqueeze(1).detach().numpy()) | |
return {"accuracy":accu,"f1":f1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model=Model(len(trainx.columns)) | |
optimizer=torch.optim.SGD(model.parameters(),lr=0.001) | |
criterion=torch.nn.BCELoss() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model(torch.nn.Module): | |
def __init__(self,col_size): | |
super().__init__() | |
# using sequencial | |
self.seq=torch.nn.Sequential( | |
torch.nn.Linear(col_size,15), | |
torch.nn.ReLU(), | |
torch.nn.Linear(15,10), | |
torch.nn.ReLU(), | |
torch.nn.Linear(10,1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train_x,test_x,train_y,test_y=train_test_split(trainx,trainy) | |
train_x=torch.from_numpy(train_x.values) | |
train_x=train_x.type(torch.FloatTensor) | |
train_y=torch.from_numpy(train_y.values) | |
train_y=train_y.type(torch.FloatTensor) | |
test_x=torch.from_numpy(test_x.values) | |
test_x=test_x.type(torch.FloatTensor) | |
test_y=torch.from_numpy(test_y.values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df=pd.read_csv("train.csv") | |
encoders=["area_code","state","international_plan","voice_mail_plan","churn"] | |
for i in encoders: | |
le=LabelEncoder() | |
df[i]=le.fit_transform(df[i]) | |
trainy=df["churn"] | |
trainx=df[['state', 'account_length', 'area_code', 'international_plan', |
NewerOlder