This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
→ jclouds-examples[master+]/blobstore-clojure$ lein repl | |
"REPL started; server listening on localhost:26225." | |
user=> (use 'create-list.containers) | |
nil | |
user=> (create-and-list "transient" "foo" "bar" "mycontainer") | |
#<PageSetImpl [[type=CONTAINER, id=null, name=stub, location=[id=transient, scope=PROVIDER, description=http://localhost/transient, parent=null, iso3166Codes=[], metadata={}], uri=null, userMetadata={}], [type=CONTAINER, id=null, name=mycontainer, location=[id=transient, scope=PROVIDER, description=http://localhost/transient, parent=null, iso3166Codes=[], metadata={}], uri=null, userMetadata={}]]> | |
user=> (create-and-list "aws-s3" "***" "***" "vkbucket") | |
#<PageSetImpl []> | |
user=> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers; | |
import org.apache.commons.mail.*; | |
import play.*; | |
import play.mvc.*; | |
import play.libs.*; | |
import java.util.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn index | |
"Get list of gamers" | |
([] (println "GET for the list of Gamers")) | |
([id] (println "GET for the gamer with " id))) | |
(defroutes routes | |
(GET "/gamers" [] (index)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void sendMail() throws Exception{ | |
EmailAttachment attachment = new EmailAttachment(); | |
attachment.setPath("/Users/vijay/Desktop/test.scala"); | |
attachment.setDisposition(EmailAttachment.ATTACHMENT); | |
attachment.setDescription("Scala File"); | |
attachment.setName("test.scala"); | |
// Create the email message | |
MultiPartEmail email = new MultiPartEmail(); | |
email.addTo("blah@example.com", "Vijay Kiran"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn index | |
[] | |
(ring.util.response/file-response "index.html")) | |
;;; routes | |
(defroutes routes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
predictions = X * theta; %number of traing examples on m examples | |
sqrErrors = (predictions - y).^2; % squared errors | |
J = (1 / (2 *m) * sum(sqrErrors) ) + sum(theta(2:end) .^ 2) * lambda / (2 * m); | |
grad = (1 / m) * ((X' * (predictions - y)) + (lambda * theta)); | |
grad(1) -= (1 / m ) * (lambda * theta(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i = 1:m | |
subsetX = X(1:i, :); | |
subsetY = y(1:i); | |
[theta] = trainLinearReg(subsetX, subsetY,lambda); | |
[error_train(i),grad_train] = linearRegCostFunction(subsetX, subsetY, theta, 0); | |
[error_val(i),grad_val] = linearRegCostFunction(Xval, yval, theta, 0); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i=1:p | |
X_poly(:,i) = X .^i; | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i = 1:length(lambda_vec) | |
subsetX = X(1:i, :); | |
subsetY = y(1:i); | |
[theta] = trainLinearReg(subsetX, subsetY,lambda_vec(i)); | |
[error_train(i),grad_train] = linearRegCostFunction(subsetX, subsetY, theta, lambda_vec(i)); | |
[error_val(i),grad_val] = linearRegCostFunction(Xval, yval, theta, lambda_vec(i)); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i = 1:length(lambda_vec) | |
[theta] = trainLinearReg(X,y,lambda_vec(i)); | |
[error_train(i),grad_train] = linearRegCostFunction(X, y, theta, 0); | |
[error_val(i),grad_val] = linearRegCostFunction(Xval, yval, theta, 0); | |
end |
OlderNewer