Matrices
Tip #1
Declaration - matrix (0,3,4)
3 rows, 4 columns and values 0
print[1,1]
Tip #2
Vector a <- 1:12 (To fill Matrix)
matrix(a, 3, 4)
Tip #3
Assigning, Fetching & Printing values
plank <- 1:8 - Create Vector
dim(plank) <- c(2,4) - Assign Dimension
print(plank) - Print values
plank[1,4] <- 0 - Assign value
plank[2,] - Fetch all 2nd row values
Tip #4 - Plotting Matrix
elevation <- matrix(2,5,10)
contour(elevation) - 2D representation
persp(elevation) - 3D representation
persp(elevation, expand = 0.2)
Statistics
Tip #1 - Mean computation
a <- c(1,2,3,4,5)
mean(a)
barplot(a)
median(a)
Tip #2
Horizontal line across plots
abline(h=mean(a))
abline(h=median(a))
Tip #3
Standard Deviation
deviation <- sd(a)
Factors
Tip #1
R has special collection called factors
chests <- c('gold', 'silver', 'gems', 'gold', 'gems')
types <- factor(chests)
print(types)
Data Frame
Similar to Database
Tip #1 - Loading data from files
read.csv("data.csv")
read.table("a.txt",sep="\t")
Tip #2 - Merge Data Frames
data1 <- read.csv("data.csv")
data2 <- read.table("a.txt",sep="\t")
merge(x = data1, y = data2)
Real World Examples
Data1 <- read.csv("a.csv")
Data2 <- read.table("b.txt", sep=" ", header=TRUE)
TargetData <- merge(x = Data1, y = Data2)
plot(TargetData$Data1, TargetData$Data2)
August 17, 2015
August 16, 2015
R Online Learning
I prefer to switch topics when I find it tricky to focus on one topic. I found R language easy, simple and great to get started. Codeschool has a beautiful self learning portal. This lists cheat sheet and fundamentals working with R. Capturing some of notes for my future reference.
Using R
Tip #1 - Assignment
x <- 42
y <- "Hello"
Tip #2 - Expression
5==10
5>10
Tip #3 - Arithmetic operations
2+2
3*3
Tip #4 - Functions
sum(1,2)
sum(1,2,3,4)
Help
Tip #5 - File I/O
list.files()
source(filename)
Vectors
Tip #1 - Vector
List of Values - vector represented by c(2,3,4)
List of Strings - vector represented by c('a','b','c')
List with multiple data types - vector represented by c(1,'a', TRUE)
Tip #2 - Sequence Vectors
Representing sequence of numbers m to b by m:n
- seq(10,50)
- seq(10,50,5) - With increment step 5
- seq(50,10) - Reverse sequence representation
Tip #3 - Assigning Vectors (Single Quotes)
sentence <- c('walk', 'the', 'plank')
sentence[3]
a <- c (1,2,3)
b <- c (1,2,3)
Sample Vector Operations
a+1
a*2
a+b
x <- seq(1, 20, 0.1)
y <- sin(x)
Tip #4
c for combine vectors
c(1,2,3)
Tip #5
Plotting Vectors
vectorCoordinates <- c(4, 5, 1)
barplot(vectorCoordinates)
barplot(1:100)
x <- seq(1, 20, 0.1)
y <- sin(x)
plot(x,y)
Great Learning Sites
Statsmethod
Code School
Happy Learning!!!
Labels:
Maths
August 15, 2015
Recommendation Algorithm Analysis
Item to Item Rating based on customer’s purchase of products
The formula for comparison is dot product divided by product of vector lengths
In the example for two sets Book and DVD
The formula for comparison is dot product divided by product of vector lengths
In the example for two sets Book and DVD
- Book – (1,1,1) – Set A consider it as (A1, A2, A3)
- DVD – (1,0,0) – Set B consider it as (B1, B2, B3)
- (A1.B1 + A2.B2 + A3.B3) /sqrt((A1 square + A2 Square + A3 Square)( B1 square + B2 Square + B3 Square))
- (1)/sqrt((3).sqrt(1)
- 1 / 1.732
- 0.577
Item to Item Comparison based on customer ratings
The formula for comparison is dot product divided by product of vector lengths
In the example for two sets Book and DVD
- Book – (4,3,5) – Set A consider it as (A1, A2, A3)
- DVD – (1,0,0) – Set B consider it as (B1, B2, B3)
- (A1.B1 + A2.B2 + A3.B3) /sqrt((A1 square + A2 Square + A3 Square)( B1 square + B2 Square + B3 Square))
- (4)/sqrt((16+9+25).sqrt(1)
- 4/7.07
- 0.565
Happy Learning!!!
August 14, 2015
Good Courses
Bookmarking two useful courses on Statistics and Machine Learning
Machine Learning Coursera
Statistics 110
Statistics and Data
Statistics One
Machine Learning Coursera
Statistics 110
Statistics and Data
Statistics One
Descriptive Statistics
Good One - How to Become a Data Scientist for Free
Happy Learning!!!
Labels:
Data Science
August 13, 2015
Matrix and Determinants (Basics)
Back to School and basics. These posts are for my on-line references.
Matrix
Matrix
- Rectangular Array of Numbers in rows and columns
- Example - [5,2,-3]
- Order of Matrix is represented as Rows X Columns
- Row matrix (1 Row, any number of columns)
- Column matrix (1 Column, Multiple Rows)
- Diagonal matrix (Square matrix, Except diagonal elements every other elements are 0)
- Scalar matrix (Square matrix & Diagonal matrix in which all diagonal elements are same)
- Identity matrix - Denoted by I - Diagonal Elements are 1 (Square & Diagonal Matrix)
- Transpose of matrix - Matrix where rows and columns are interchanged
[ 1, 1, 1 ]
A = [ 2, 2, 2 ]
[ 3, 3, 3 ]
Transpose is
A' = [ 1, 2, 3 ]
[ 1, 2, 3 ]
[ 1, 2, 3 ]
Addition of Matrices
- They should be of same order
- Add Corresponding elements
A = [2,3,5]
[5,7,-2]
[5,3,0]
B = [7,-1,5]
[0,2,3]
[7,5,2]
Result ( Add Corresponding elements in same positions)
A + B = [9,2,10]
[5,9,1]
[12,8,2]
Subtraction (similar to addition)
- Order needs to match
A = [7,-2]
[0,3]
B = [0,2]
[3,5]
A - B = [7,-4]
[-3,-2]
Scalar Multiplication
- Multiplying constant with a Matrix
- Every Element of Matrix Multipled
c = [3,5]
[-2,-10]
-2c = [-6,-10]
[4,20]
Matrix Multiplication
- A (m x n)
- B (n x p)
- Columns in a (n) = Number of Rows in B (n)
A = [3,5]
[7,2]
[2,3]
B = [-2,5]
[3,7]
AB = Operate First Row (Operate) Multiple with First Coulmn
A = [3,5] --->
[7,2]
[2,3]
Select Column
B = [-2,5]
[3,7]
= [ 3 X -2 + 5 X 3, 3 X 5 + 5 X 7 ]
[ 7 X -2 + 2 X 3, 7 X 5 + 2 X 7 ]
[ 2 X -2 + 3 X 3, 2 X 5 + 3 X 7 ]
= [9,50]
[-8,49]
[5,31]
Matrix Multiplication is not commutative
Determinant of Square Matrix
+ -
A = [5,6]
[3,-4]
|A| = [Multiply Principal Diagonal Elements ] - [Subtract the Next Diagonal Elements]
= (5 X -4) - (3 X 6)
= -20 - 18
= -38
Determinant of 3 X 3 Matrix
+,-,+
A = [3,-2,1]
[2,3,4]
[2,5,4]
= +3 X [3,4] - (-2) X [2,4] + 1 X [2,3]
[5,4] [2,4] [2,5]
= 3(12-20) + 2 (8-8) + 1(10-6)
= -24 + 0 + 4
= -20
References - Link
Happy Learning!!!
Labels:
Maths
June 19, 2015
Mobile Test Automation Startups
Interesting start-ups coming up in this space
Other high visible companies include saucelabs, browserstack, perfecto mobile etc..
Happy Learning!!
Other high visible companies include saucelabs, browserstack, perfecto mobile etc..
Happy Learning!!
Labels:
Mobile Automation
June 07, 2015
Weekend Tech Talks
Excellent Talk on Android Testing and Automation Fundamentals
Good Notes / Screenshots from Session
Why Automated Testing, What does it Solve ?
What are pros / cons of Automation vs Manual Test Efforts ?
How to use Record / Play back tools ?
Mobile testing options Emulators / Devices ?
Evaluating a Commercial Tool ?
Happy Learning!!!
Good Notes / Screenshots from Session
Why Automated Testing, What does it Solve ?
What are pros / cons of Automation vs Manual Test Efforts ?
How to use Record / Play back tools ?
Mobile testing options Emulators / Devices ?
Evaluating a Commercial Tool ?
Happy Learning!!!
Labels:
Weekend Tech Talks
June 03, 2015
Setting up Jmeter Code base on Windows
Today Dinesh & myself had a good learning time in setting up Jmeter code base. There are not too many blogs / notes. This is a basic draft capturing the steps at high level. Good one for Windows background developers :).
1. Download Jmeter Zip code from Github
2. Create Project with same name. Eclipse - eclipse-jee-kepler-R-win32-x86_64
3. Setup Java Project
4. Set Ant Perspective
5. Execute Download Jars option as Ant Build (Run as Ant Build)
6. Download all the JAR files from link https://www.bouncycastle.org/latest_releases.html (Below mentioned versions)
7. Java Compiler Settings
Happy Learning!!!
1. Download Jmeter Zip code from Github
2. Create Project with same name. Eclipse - eclipse-jee-kepler-R-win32-x86_64
3. Setup Java Project
4. Set Ant Perspective
5. Execute Download Jars option as Ant Build (Run as Ant Build)
6. Download all the JAR files from link https://www.bouncycastle.org/latest_releases.html (Below mentioned versions)
Output path specified as below
8. Following code changes done for non matching jars
9. Below value set at Code Level
Labels:
Coding Learning's
May 24, 2015
Interesting Sites
Two new interesting sites
Security Tools and Market Share of them - @ sectoolmarket
Collection of useful tech talks available @ techtalkshub
Happy Learning!!!
Security Tools and Market Share of them - @ sectoolmarket
Collection of useful tech talks available @ techtalkshub
Happy Learning!!!
Labels:
Interesting Sites
Subscribe to:
Posts (Atom)






