faridcher / ml-course Goto Github PK
View Code? Open in Web Editor NEWStarter code of Prof. Andrew Ng's machine learning MOOC in R statistical language
Home Page: https://www.coursera.org/learn/machine-learning
Starter code of Prof. Andrew Ng's machine learning MOOC in R statistical language
Home Page: https://www.coursera.org/learn/machine-learning
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.
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
All images in the wiki appear to be broken. E.g. https://github.com/faridcher/ml-course/wiki/instructions#21-plotting-the-data under "Figure 1: Scatter plot of training data" all I see is a broken image link icon.
Was getting a strange error in assignment 3. Turns out the sigmoid function in sigmoid.R is blank, but there is no * indicaated that it needs to be completed in the Introduction to the assignment https://github.com/faridcher/ml-course/wiki/3#introduction
While submitting, i receive this error !! Submission failed: unexpected error: object 'grad' not found
!! Please try again later.Error: object of type 'special' is not subsettable
Please help me!
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.
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
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
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"
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.