Git Product home page Git Product logo

faridcher / ml-course Goto Github PK

View Code? Open in Web Editor NEW
168.0 168.0 150.0 37.33 MB

Starter code of Prof. Andrew Ng's machine learning MOOC in R statistical language

Home Page: https://www.coursera.org/learn/machine-learning

R 100.00%
anomalydetection classification clustering gradient-descent k-means learning-curve linear-regression machine-learning neural-network pca principal-component-analysis recommender-system regularization svm

ml-course's People

Contributors

faridcher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ml-course's Issues

Typo in gradientdescentmulti.R in starter ex1

The following is the original code from your starter section

gradientDescentMulti <- function(X, y, theta, alpha, num_iters) {
  #GRADIENTDESCENTMULTI Performs gradient descent to learn theta
  #   theta <- GRADIENTDESCENTMULTI(x, y, theta, alpha, num_iters) updates theta by
  #   taking num_iters gradient steps with learning rate alpha
  
  # Initialize some useful values
  m <- length(y) # number of training examples
  J_history <- rep(0,num_iters)
  
  for (iter in 1:num_iters) {
    # ---------------------- YOUR CODE HERE ----------------------
    # Instructions: Perform a single gradient step on the parameter vector
    #               theta.
    #
    # Hint: While debugging, it can be useful to print out the values
    #       of the cost function (computeCostMulti) and gradient here.
    #
    
    
    }
    
    # ------------------------------------------------------------
    
    # Save the cost J in every iteration
    J_history[iter] <- computeCostMulti(X, y, theta)
    
  }
  list(theta = theta, J_history = J_history)
}

We get following error

> submit()
== Submitting solutions | Linear Regression with Multiple Variables... 
Login (email address): 
username(#replaced)
token:
token(#replaced)
!! Submission failed: unexpected error: gradientDescentMulti.R:29:1: unexpected '}'
28:   list(theta = theta, J_history = J_history)
29: }
    ^
!! Please try again later.
Error in response$errorMessage : 
  object of type 'special' is not subsettable

The curly brace above save the cost J in every iteration should be commented out. The issue pointed by one of the user might be because of this. After commenting that curly brace, the program is working fine. Thanks for developing this and making available for free.

pred <- predict(Theta1, Theta2, X[rp[1],]) Error in rep(0, m) : invalid 'times' argument

Hi Fared,
The 94th line of the ex3_nn.R reads as follows:
pred <- predict(Theta1, Theta2, X[rp[i],])

It is called from inside this loop:
for (i in 1:m){
pred <- predict(Theta1, Theta2, X[rp[i],])
}

I am getting the following error:

pred <- predict(Theta1, Theta2, X[rp[1],])
Error in rep(0, m) : invalid 'times' argument

The predict function worked fine when it was invoked the first time in the same program at line 76
pred <- predict(Theta1, Theta2, X)

I could not find anything wrong with the repeat command used inside the predict function at row 14
p <- rep(0,m) where m <- dim(X)[1]

I am not sure if the function results are cached in R the first time which causes problem when called again.

Can you please help.

https://github.com/faridcher/machine-learning-course/blob/master/Solutions/mlclass-ex3/ex3_nn.R

why Theta is called as a subfunction

Hi Fared,
Curios to know why you create function within function (Theta as a subfunction of cost function).
For example,

linearRegCostFunction <- function(X, y, lambda) {
function(theta) {

why not
linearRegCostFunction <- function(X, y, lambda,theta) {

Is it just a coding style or there is a particular reason.

Thanks in advance.

Submission error

Hi
First things first, thank you for this very good resource for leaarning maching learning. May the good lord continue to bless you.

However I have an error in running ex1.R.
I keep getting this error message below

Running warmUpExercise ...
5x5 Identity Matrix:
Error in warmUpExercise() : object 'A' not found

Any help.
Thanks

P.S I have tried this also.. same result

source("D:/UIUC PHD/MACHINE LEARNING/COURSERA/EXERCISES/1/ex1.R")
Running warmUpExercise ...
5x5 Identity Matrix:
Error in warmUpExercise() : object 'A' not found

Problems with submission

Hi, I've been having a problem with submission (please see below).

Do you have any idea why this might be happening?

Cheers
Bob

source("submit.r")
submit()
== Submitting solutions | Linear Regression with Multiple Variables...
Login (email address):
[email protected]
token:
4BIEsjivD1WGjERU
!! Submission failed: unexpected error: gradientDescentMulti.R:29:1: unexpected '}'
28: list(theta = theta, J_history = J_history)
29: }
^
!! Please try again later.
Error in response$errorMessage :
object of type 'special' is not subsettable

Problem with submission

Thank you so much for creating this repository. This is exactly what I need! I am very eager to get this up and running, however, in testing it out, when trying to submit the warm up exercise in exercise 1, I get the following error message:

!! Submission failed: unexpected error: object 'A' not found
!! Please try again later.Error: object of type 'special' is not subsettable

This error occurs after entering my coursera email and the token.

Attached is the exact code which I run to produce the error, and below is some info regarding my R version and ubuntu system:

Any help on this issue would be great.
Thanks again!

R.Version()
$platform
[1] "x86_64-pc-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "3"

$minor
[1] "4.2"

$year
[1] "2017"

$month
[1] "09"

$day
[1] "28"

$svn rev
[1] "73368"

$language
[1] "R"

$version.string
[1] "R version 3.4.2 (2017-09-28)"

$nickname
[1] "Short Summer"

submission problem warm up.txt

Matlab file to R file (.mat to .Rda) converstion

Hello Farid,
I am a newbie in R; finding your Github repository very useful in coming up to speed.

Can you please help me understand how you converted a matlab file (.mat) into an R file (.Rda)

https://github.com/faridcher/ machine-learning-course/tree/ master/Starter/mlclass-ex3

from ex3data1.mat in matlab to
'ex3data1.Rda'

Thank you for the help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.