supervised-learning

Creating Neural Network for un-encountered inputs

南楼画角 提交于 2019-12-06 07:53:27
I am creating a simple Multi-layered feed forward Neural Network using AForge.net NN library. My NN is a 3 Layered Activation Network trained with Supervised Learning approach using BackPropogation Learning algorithm. Following are my initial settings: //learning rate learningRate=0.1; //momentum value momentum=0; //alpha value for bipolar sigmoid activation function sigmoidAlphaValue=2.0; //number of inputs to network inputSize=5; //number of outputs from network predictionSize=1; //iterations iterations=10000; // create multi-layer neural network ActivationNetwork network = new

How to use machine learning to calculate a graph of states from a sequence of data?

六眼飞鱼酱① 提交于 2019-12-05 20:02:53
Generic formulation I have a dataset consisting of a sequence of points with 12 features each. I am interested in detecting an event in this data. In the training data I know the moments the event occurred. When the event occurs I can see an observable pattern in the sequence of points before the event. The pattern is formed from about 300 consecutive points. I am interested in detecting when the event occurred in a infinite sequence of points. The analysis happens post factum. I am not interested in predicting if the event will occur. Concrete example You may skip this section I am building a

TensorFlow MLP not training XOR

笑着哭i 提交于 2019-12-05 00:26:40
问题 I've built an MLP with Google's TensorFlow library. The network is working but somehow it refuses to learn properly. It always converges to an output of nearly 1.0 no matter what the input actually is. The complete code can be seen here. Any ideas? The input and output (batch size 4) is as follows: input_data = [[0., 0.], [0., 1.], [1., 0.], [1., 1.]] # XOR input output_data = [[0.], [1.], [1.], [0.]] # XOR output n_input = tf.placeholder(tf.float32, shape=[None, 2], name="n_input") n_output

Scikit-learn: How to calculate the True Negative

半世苍凉 提交于 2019-12-04 19:44:14
问题 I am using Scikit-learning and I need to calculate the True positive (TP), the False Positive (FP), the True Negative (TN) and the False Negative (FN) from a confusion matrix like this: [[2 0 3 4] [0 4 5 1] [1 0 3 2] [5 0 0 4]] I know how to calculate the TP, the FP and the FN but I don't know how to get the TN. Can someone tell me? 回答1: I think you should treat this multi-class classification in a one-vs-the-rest manner (so each 2x2 table i measures the performance of a binary classification

Time Series Ahead Prediction in Neural Network (N Point Ahead Prediction) Large Scale Iterative Training

拈花ヽ惹草 提交于 2019-12-04 18:16:28
问题 (N=90) Point ahead Prediction using Neural Network: I am trying to predict 3 minutes ahead i.e. 180 points ahead. Because I compressed my time series data as taking the mean of every 2 points as one, I have to predict (N=90) step-ahead prediction. My time series data is given in seconds. The values are in between 30-90. They usually move from 30 to 90 and 90 to 30, as seen in the example below. My data could be reach from: https://www.dropbox.com/s/uq4uix8067ti4i3/17HourTrace.mat I am having

Plot SVM with Matplotlib?

拜拜、爱过 提交于 2019-12-03 20:42:55
I have some interesting user data. It gives some information on the timeliness of certain tasks the users were asked to perform. I am trying to find out, if late - which tells me if users are on time ( 0 ), a little late ( 1 ), or quite late ( 2 ) - is predictable/explainable. I generate late from a column giving traffic light information (green = not late, red = super late). Here is what I do: #imports import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import preprocessing from sklearn import svm import sklearn.metrics as sm #load user data df = pd.read_csv(

String Subsequence Kernel and SVM using Python

你。 提交于 2019-12-03 16:58:44
How can I use Subsequence String Kernel (SSK) [Lodhi 2002] to train a SVM (Support Vector Machine) in Python? Juan Antonio Barragan This is an update to gcedo's answer to work with the current version of shogun (Shogun 6.1.3). Working example: import numpy as np from shogun import StringCharFeatures, RAWBYTE from shogun import BinaryLabels from shogun import SubsequenceStringKernel from shogun import LibSVM strings = ['cat', 'doom', 'car', 'boom','caboom','cartoon','cart'] test = ['bat', 'soon', 'it is your doom', 'i love your cat cart','i love loonytoons'] train_labels = np.array([1, -1, 1,

TensorFlow MLP not training XOR

我是研究僧i 提交于 2019-12-03 16:03:21
I've built an MLP with Google's TensorFlow library. The network is working but somehow it refuses to learn properly. It always converges to an output of nearly 1.0 no matter what the input actually is. The complete code can be seen here . Any ideas? The input and output (batch size 4) is as follows: input_data = [[0., 0.], [0., 1.], [1., 0.], [1., 1.]] # XOR input output_data = [[0.], [1.], [1.], [0.]] # XOR output n_input = tf.placeholder(tf.float32, shape=[None, 2], name="n_input") n_output = tf.placeholder(tf.float32, shape=[None, 1], name="n_output") Hidden layer configuration : # hidden

Scikit-learn: How to calculate the True Negative

↘锁芯ラ 提交于 2019-12-03 12:53:53
I am using Scikit-learning and I need to calculate the True positive (TP), the False Positive (FP), the True Negative (TN) and the False Negative (FN) from a confusion matrix like this: [[2 0 3 4] [0 4 5 1] [1 0 3 2] [5 0 0 4]] I know how to calculate the TP, the FP and the FN but I don't know how to get the TN. Can someone tell me? I think you should treat this multi-class classification in a one-vs-the-rest manner (so each 2x2 table i measures the performance of a binary classification problem that whether each obs belongs to label i or not). Consequently, you can calculate the TP, FP, FN,

Plot learning curves with caret package and R

我与影子孤独终老i 提交于 2019-11-30 04:00:59
I would like to study the optimal tradeoff between bias/variance for model tuning. I'm using caret for R which allows me to plot the performance metric (AUC, accuracy...) against the hyperparameters of the model (mtry, lambda, etc.) and automatically chooses the max. This typically returns a good model, but if I want to dig further and choose a different bias/variance tradeoff I need a learning curve, not a performance curve. For the sake of simplicity, let's say my model is a random forest, which has just one hyperparameter 'mtry' I would like to plot the learning curves of both training and