# Save parameters every a few SGD iterations as fail-safe
SAVE_PARAMS_EVERY = 1000
import
import
import
import
import
glob
random
numpy as np
os.path as op
cPickle as pickle
def load_saved_params():
" A helper function that loads previously saved paramete
import numpy as np
import random
from q1_softmax import softmax
from q2_sigmoid import sigmoid, sigmoid_grad
from q2_gradcheck import gradcheck_naive
def forward_backward_prop(data, labels, params, dimensions):
"
Forward and backward propagation for a two
import numpy as np
import random
def softmax(x):
"
Compute the softmax function for each row of the input x.
It is crucial that this function is optimized for speed because
it will be used frequently in later code.
You might find numpy functions np.exp, n
import numpy as np
import random
from q1_softmax import softmax
from q2_gradcheck import gradcheck_naive
from q2_sigmoid import sigmoid, sigmoid_grad
def normalizeRows(x):
" Row normalization function "
# Implement a function that normalizes each row of a
#= Numerical / Arithmetic Tests
#- ALL tests here should return TRUE !
#
# '#P': These lines don't give TRUE but relevant `Print output'
# -> d-p-q-r-tests.R
for distribution things
.proctime00 <- proc.time()
opt.conformance <- 0
Meps <- .Machine $ double
The Ultimate R Cheat Sheet Data Management (Version 4)
Google R Cheat Sheet for alternatives. The best cheat sheets are those that you make yourself!
Arbitrary variable and table names that are not part of the R function itself are highlighted in bold.
Im
R Cheat Sheet: OOP and S3 Classes
What is object oriented programming?
While definitions for OOP abound without
clear agreement, OOP languages typically
focus programmers on the actors/objects
(nouns) of a problem rather than the
actions/procedures (verbs
R Cheat Sheet: tRips and tRaps for new players
General
Trap: R error messages are not helpful
Tip: use traceback() to understand errors
Object coercion
Trap: R objects are often silently coerced
to another class/type as/when needed.
Examples: c(1, TRUE
R Cheat Sheet: Brief Introduction to Language Elements and Control Structures
Comments
# from the hash to the end of the line
Basic (underlying) data-types
1) logical Boolean TRUE/FALSE
2) integer 32 bit signed integer number
3) double double precision re
R Cheat Sheet: Atomic Vectors (often just called "vectors" in R)
Atomic vectors:
- An object with contiguous, indexed values
- Indexed from 1 to length(vector)
- All values of the same basic atomic type
- Vectors do not have a dimension attribute
- Has a
R Cheat Sheet: Lists
Context: R has two types of vector
Atomic vectors contain values
These values are all of the same type.
They are arranged contiguously. Atomic
vectors cannot contain objects. There are
six types of atomic vector: raw, logical,
integer
R Cheat Sheet: Avoiding For-Loops
What is wrong with using for-loops?
Nothing! R's (for-while-repeat) loops are
intuitive, and easy to code and maintain.
Some tasks are best managed within loops.
So why discourage the use of for-loops?
1) Side effects
What you need to do for this problem is:
1. Get familiar with the clustering algorithms in Weka. This will allow you to see what parameter options
there are for the various algorithms, and you can visualize the clusters for the Iris dataset.
2. Learn how