Skip to content

Merge pull request #1 from JacobLee121/JacobLee121-patch-plot#2

Open
JacobLee121 wants to merge 1 commit intoJacobLee121-patch-plotfrom
master
Open

Merge pull request #1 from JacobLee121/JacobLee121-patch-plot#2
JacobLee121 wants to merge 1 commit intoJacobLee121-patch-plotfrom
master

Conversation

@JacobLee121
Copy link
Copy Markdown
Owner

@JacobLee121 JacobLee121 commented Mar 15, 2017

coding: utf-8

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from pandas import *

from future import division

import csv
with open ("E:/6Machine Learning/Deep learning/ML2017/hw1.1/hw1/data/train.csv", "r") as csvfile:
read = csv.DictReader(csvfile)
price = [row["price"] for row in read]
p = [int(item) for item in price]
a = len(price)
ss = len(p)
with open("E:/6Machine Learning/Deep learning/ML2017/hw1.1/hw1/data/train.csv", "r") as csvfile:
read = csv.DictReader(csvfile)
sqft_living=[row["sqft_living"] for row in read]
#"""convert the data type from str to int"""
s_l = [int(item) for item in sqft_living]
b=len(sqft_living)
bb=len(s_l)

plt.figure(1)

plt.plot(price, sqftliving)

plt.show()

print(bb)
print(ss)
print(p)
print(s_l)
f1=plt.figure(1)
plt.subplot(211)
plt.scatter(p,s_l)
plt.subplot(212)
plt.scatter(s_l,p)
plt.show()
def sum_of_squares(v):
"""computes the sum of squared element in v"""
return sum(v_i ** 2 for v_i in v)
sum_of_squares(p)
print(sum)
def difference_quotient(f,x,h):
return (f(x+h)-f(x))/h
"""estimate_gradeient"""
def step(v,direction, step_size):
"""move step_size in the dirction from v"""
return [v_i + step_size * direction_i
for v_i, direction_i in zip(v,direction)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant