Trying determining degree polynomial for polynomical regression

I'm trying to predict the birth weight baby using polynomial regression model. First what I need know what degree polynomial should fit better to my data. In order to do that I split my dataset in training set (70%) and Cross Validation set(30%) and then plots each error by degree polynomial. I did run my script 4 times selecting randomly the data but I get so different curves each time as you can see I don't know why this happens …
Category: Data Science

How to recover the decision boundary from LIBSVM?

I am trying to recover the decision boundary from the model resulting from "svmtrain" of LIBSVM in Octave. The output of the model is shown in the following, I highlighted the parameters I think correspond to the decision boundary equation: This is the decision boundary equation: How do I recover the decision boundary "u" using the equation and the model parameters above? I'd like to do this without calling "svmpredict". Thanks.
Topic: octave libsvm
Category: Data Science

Python function returning a 4x4 matrix instead of a floating number like in an equivalent Octave function in a Linear Regression problem

I am trying to translate code from Octave to Python, and I am stuck. I am aware they are libraries out there such as scikit-learn etc., but for my own learnin,g I would like to be able to implement the cost function from scratch. Furthermore, I managed to solve some issues by looking into numpy documentation, but I am still stuck with one last one. The function doesn't return the expected result. I am providing everything you need to reproduce …
Category: Data Science

How do I plot data in Octave?

I wanted to plot a data in Octave for a logistic regression problem my teacher in my university assigned me to solve. Let's say the input-training features is a matrix X and output is y=1 or y=0 To plot the data I made this statement: pos = find(y==1);neg = find(y==0); plot(X(pos,1),X(pos,2),’k+’,’LineWidth’,2,’MarkerSize’,7); plot(X(neg,1),X(neg,2),’ko’,’MarkerFaceColor’,y,’MarkerSize’,7); But it does not compile and it shows the single quotes as unidentified characters. Please help...
Topic: octave
Category: Data Science

K-Means clustering for mixed numeric and categorical data

My data set contains a number of numeric attributes and one categorical. Say, NumericAttr1, NumericAttr2, ..., NumericAttrN, CategoricalAttr, where CategoricalAttr takes one of three possible values: CategoricalAttrValue1, CategoricalAttrValue2 or CategoricalAttrValue3. I'm using default k-means clustering algorithm implementation for Octave. It works with numeric data only. So my question: is it correct to split the categorical attribute CategoricalAttr into three numeric (binary) variables, like IsCategoricalAttrValue1, IsCategoricalAttrValue2, IsCategoricalAttrValue3 ?
Category: Data Science

What are the differences and advantages of TensorFlow and Octave for machine learning?

I have been exploring the different libraries and languages you can use in order to implement machine learning. During this, I have stumbled upon a library TensorFlow and Octave(a high-level programming language) as both are intended for numerical computations. What are the differences and advantages of using either?
Category: Data Science

Higher dimension data visualization in Matlab/Octave

I am working on sparse recovery for a classification task. I use Pine hyperspectral dataset which is a freely available dataset and this image contains 200 Dimension (Depth/channels/bands). In addition, this dataset contains labels (Ground truth information). Thus I extract the corresponding pixels for each class and now I want to visualize them to see really how they look like. But I do know now how to visualize them for all 200 channels. I did this visualization for 3D but …
Category: Data Science

Problem with calculating error rate for KNN

I am trying to validate the accuracy of my KNN algorithm for the movie rating prediction. I have $2$ vectors: $Y$ - with the real ratings, $Y'$ - with predicted ones. When I calculate Standard Error of the Estimate (is it the one I need to calculate?) using following formula: $$\sigma_{est} = \sqrt{\frac{\sum (Y-Y')^2}{N}}$$ I'm getting result of $\sim 1.03$. But I thought that it can't be $> 1$. If it is not, then what does this number say to …
Category: Data Science

Plot 2D function: do I need to pass all the values to the function?

I'm new with Octave and I need to plot this function: % Computes the value of the Powell Sum benchmark function. % SCORES = POWELLSUMFCN(X) computes the value of the Powell Sum function at % point X. POWELLSUMFCN accepts a matrix of size M-by-N and returns a vetor % SCORES of size M-by-1 in which each row contains the % function value for the corresponding row of X. % % Author: Mazhar Ansari Ardeh % Please forward any comments or …
Category: Data Science

Applying neural network for simple x^2 function for demonstration purpose

I have tried to train a neural network for a simple x^2 function I developed training data in excel. First column (X) is =RANDBETWEEN(-5,5) i.e random integer between -5 and 5 Second column simply squares first column And third column, my output 'y' column is 0 or 1. 0 if second column is less than 12.5 else 1 I made 850 training examples and used the first column as 'X' and third column as 'y' However I am only able …
Category: Data Science

Please suggest some simple functions that I can use to test my neural network implementation

I am a beginner and I have developed code in Octave to train a neural network (as part of Andrew Ng's coursera course). Now I would like to generate some datasets in Excel for simple mathematical functions and try and train my neural network implementation. I tried y = x^2 and y = sin(x), but my training accuracy is only around 67%. I have varied the number of hidden layer units, varied the lambda, but still don't get good results. …
Category: Data Science

Clarification about Octave data size limit

I'm just starting to work on a relatively large dataset after ML course in Coursera. Trying to work on https://archive.ics.uci.edu/ml/datasets/YearPredictionMSD. Got an accuracy of 5.2 in training and test set with linear regression using gradient descent in octave. I tried adding all possible quadratic features (515345 instances and 4275 features), but the code just won't stop executing in my HP Pavilion g6 2320tx, with 4GB RAM in Ubuntu 14.04. Is this beyond the data size capacity of Octave ?
Topic: octave
Category: Data Science

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.