Logistic Regression

    0

    0

    Mansimar Anand

    Logistic Regression implementation in python

    import pandas as pd
    from sklearn.cross_validation import train_test_split
    import numpy as np
    from sklearn.preprocessing import StandardScaler
    import matplotlib.pyplot as plt
    from sklearn.linear_model import LogisticRegression
    
    dataset = pd.read_csv('file_name')
    x = []
    y = []
    xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size = 0.25, random_state = 0)
    sc_x = StandardScaler()
    xtrain = sc_x.fit_transform(xtrain) 
    xtest = sc_x.transform(xtest)
    classifier = LogisticRegression(random_state = 0)
    classifier.fit(xtrain, ytrain)
    y_pred = classifier.predict(xtest)
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.