logistic_1.py - # -*- coding: utf-8 -*"Logistic_1.ipynb...

This preview shows page 1 - 2 out of 2 pages.

# -*- coding: utf-8 -*-"""Logistic_1.ipynbAutomatically generated by Colaboratory.Original file is located at"""import numpy as npimport pandas as pdimport scipy.iosample_data = scipy.io.loadmat("/content/sample_data/fashion_mnist.mat")Average_tr = []StdDev_tr = []for i in range(12000):Average_tr.append(sample_data["trX"][i].mean())StdDev_tr.append(sample_data["trX"][i].std())train_X = pd.DataFrame(list(zip(Average_tr,StdDev_tr)),columns=["X1","X2"])train_Y = pd.DataFrame(sample_data["trY"][0],columns=["Y"])Average_ts = []StdDev_ts = []for i in range(2000):Average_ts.append(sample_data["tsX"][i].mean())StdDev_ts.append(sample_data["tsX"][i].std())test_X = pd.DataFrame(list(zip(Average_ts,StdDev_ts)),columns=["X1","X2"])test_Y = pd.DataFrame(sample_data["tsY"][0],columns=["Y"])X_train = np.array(train_X)Y_train = np.array(train_Y)X_test = np.array(test_X)Y_test = np.array(test_Y)class LogisticRegression:def __init__(self,X,lr=0.001,n_iters=500):self.lr = lrself.n_iters = n_iters
End of preview. Want to read all 2 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
Jingrui He
Tags
Decibel, return y

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture