Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mstampfer/Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
mstampfer committed Nov 2, 2015
2 parents 0ad6aaa + 6b87fef commit 6bbfa6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Coursera-Stanford-ML-Python

Coursera/Stanford Machine Learning course assignments in python

[![Join the chat at https://gitter.im/sgang007/Coursera-Stanford-ML-Python](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sgang007/Coursera-Stanford-ML-Python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Assignments for Andrew Ng's Machine Learning course implemented in python without solutions in line with the [Coursera Code of Honor](https://www.coursera.org/about/terms/honorcode "Coursera Honor Code"). The code is structurally equivalent to the Matlab implementation from Coursera and the results are numerically equivalent with the correct python implementation of the incomplete scripts. After completing each assignment, students can submit for grading to the Coursera website by executing the submit.py script. e.g below: (OSX or Linux) (On Windows change "export PYTHONPATH=../" to "set PYTHONPATH=..\")

```bash
```
cd Coursera-Stanford-ML-Python/ex1
export PYTHONPATH=../
python submit.py
login (Email address):
Password:
token:
==
== Part Name | Score | Feedback
== --------- | ----- | --------
Expand Down
13 changes: 10 additions & 3 deletions Submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import numpy as np
import os

from getpass import getpass


class Submission():
Expand All @@ -28,18 +27,26 @@ def submit(self):
parts[str(part_id)] = {'output': self.__output(part_id)}

result, response = self.request(parts)

response = loads(response)
try:
print response['errorMessage']
return
except:
pass
print '=='
print '== %43s | %9s | %-s' % ('Part Name', 'Score', 'Feedback')
print '== %43s | %9s | %-s' % ('---------', '-----', '--------')


for part in parts:
partFeedback = response['partFeedbacks'][part]
partEvaluation = response['partEvaluations'][part]
score = '%d / %3d' % (partEvaluation['score'], partEvaluation['maxScore'])
print '== %43s | %9s | %-s' % (self.__part_names[int(part)-1], score, partFeedback)

evaluation = response['evaluation']


totalScore = '%d / %d' % (evaluation['score'], evaluation['maxScore'])
print '== --------------------------------'
print '== %43s | %9s | %-s\n' % (' ', totalScore, ' ')
Expand Down Expand Up @@ -68,7 +75,7 @@ def login_prompt(self):
if os.path.isfile('token.txt'):
os.remove('token.txt')
self.__login = raw_input('Login (email address): ')
self.__password = getpass('Token: ')
self.__password = raw_input('Token: ')

def request(self, parts):

Expand Down

0 comments on commit 6bbfa6a

Please sign in to comment.