Skip to content

Commit 56496f1

Browse files
committed
lambda average
1 parent 1126df0 commit 56496f1

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.cache

6 Bytes
Binary file not shown.

results/ave.png

80.7 KB
Loading

src/main/scala/App.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object App {
3636
val tfilename = "train" + i + ".csv"
3737
val efilename = "estimate" + i + ".csv"
3838
val train = DataReader.trainRead(tfilename)
39-
val wlist = LeastSquares.estimate(train, 10.0)
39+
val wlist = LeastSquares.estimate(train, 0.000000001)
4040
val test = DataReader.testRead("test.csv")
4141
val estimate = new PrintWriter(efilename)
4242

vizMulti.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,25 @@
77
from pylab import *
88

99
if __name__ == "__main__":
10+
sumts = []
11+
sumxs = []
12+
for j in range(0, 500):
13+
sumts.append(0)
14+
1015
for i in range(0, 19):
1116
estimate = open('estimate' + str(i) + '.csv', 'rb')
1217

1318
estreader = csv.reader(estimate)
1419
estxs = []
1520
estts = []
21+
k = 0
1622
for row in estreader:
1723
estxs.append(row[0])
1824
estts.append(row[1])
25+
if len(sumxs) < 500:
26+
sumxs.append(row[0])
27+
sumts[k] = float(row[1]) + sumts[k]
28+
k += 1
1929
estxs = array(estxs)
2030
estts = array(estts)
2131

@@ -25,7 +35,15 @@
2535
xlim(0.0, 1.0)
2636
ylim(-1.5, 1.5)
2737
estimate.close()
28-
38+
39+
for i in range(0, 500):
40+
sumts[i] = sumts[i] / 20
41+
42+
sumts = array(sumts)
43+
sumxs = array(sumxs)
44+
print len(sumts)
45+
print len(sumxs)
46+
plot(sumxs, sumts, 'r|')
2947
show()
3048

3149

0 commit comments

Comments
 (0)