non-linear-regression

Keras model to fit polynomial

吃可爱长大的小学妹 提交于 2019-12-09 16:26:28
问题 I generated some data from a 4th degree polynomial and wanted to create a regression model in Keras to fit this polynomial. The problem is that predictions after fitting seem to be basically linear. Since this is my first time working with neural nets I assume I made a very trivial and stupid mistake. Here is my code: model = Sequential() model.add(Dense(units=200, input_dim=1)) model.add(Activation('relu')) model.add(Dense(units=45)) model.add(Activation('relu')) model.add(Dense(units=1))

Sigmoidal Modeling in R

徘徊边缘 提交于 2019-12-08 12:28:53
问题 I am currently trying to model and plot a sigmoidal curve with a low amount of points. >myExperiment V1 N mean 0.1 9 0.9 1 9 0.8 10 9 0.1 5 9 0.2 I am using the nlsLM function from the minpack.lm package. > nlsLM(mean2 ~ -a/(1 + exp(-b * (v1-o)))) Nonlinear regression model model: mean2 ~ -a/(1 + exp(-b * (v1 - o))) data: parent.frame() a b o -1.452 -0.451 1.292 residual sum-of-squares: 0.007017 Number of iterations to convergence: 27 Achieved convergence tolerance: 1.49e-08 Warning message:

Why most of the predicted results are 0 when I use a Caffe BP regression model?

做~自己de王妃 提交于 2019-12-08 08:50:31
问题 I converted my input data into hdf5 format. And each input data has a shape of 309 dims and a label the input data just as follow: part of the input data like this my net structure as follow: name: "RegressionNet" layer { name: "framert" type: "HDF5Data" top: "data" top: "label" include { phase: TRAIN } hdf5_data_param { source: "train_data_list.txt" batch_size: 100 } } layer { name: "framert" type: "HDF5Data" top: "data" top: "label" include { phase: TEST } hdf5_data_param { source: "test

Non-linear regression in Seaborn Python

 ̄綄美尐妖づ 提交于 2019-12-06 08:07:57
I have the following dataframe that I wish to perform some regression on. I am using Seaborn but can't quite seem to find a non-linear function that fits. Below is my code and it's output, and below that is the dataframe I am using, df. Note I have truncated the axis in this plot. I would like to fit either a Poisson or Gaussian distribution style of function. import pandas import seaborn graph = seaborn.lmplot('$R$', 'Equilibrium Value', data = df, fit_reg=True, order=2, ci=None) graph.set(xlim = (-0.25,10)) However this produces the following figure. df R Equilibrium Value 0 5.102041 7

Non-linear Support Vector Regression with C# and “Accord.NET”

萝らか妹 提交于 2019-12-06 04:46:41
what should I use for non-linear vector regression with C# in Accord ? Thanks (traininginputs double[][] and trainingoutput double[] NOT int[]) Accord.NET provides a Support Vector Machine learning algorithm for regression problems in the SequentialMinimalOptimizationRegression class. There is an example application for this topic in the sample application's wiki page . Here is an example on how to use it: // Example regression problem. Suppose we are trying // to model the following equation: f(x, y) = 2x + y double[][] inputs = // (x, y) { new double[] { 0, 1 }, // 2*0 + 1 = 1 new double[] {

Knn Regression in R

好久不见. 提交于 2019-12-05 02:50:14
问题 I am investigating Knn regression methods and later Kernel Smoothing. I wish to demonstrate these methods using plots in R. I have generated a data set using the following code: x = runif(100,0,pi) e = rnorm(100,0,0.1) y = sin(x)+e I have been trying to follow a description of how to use "knn.reg" in 9.2 here: https://daviddalpiaz.github.io/r4sl/k-nearest-neighbors.html#regression grid2=data.frame(x) knn10 = FNN::knn.reg(train = x, test = grid2, y = y, k = 10) My predicted values seem

Failing to do fitting with non linear fitting methods (nlsLM, nlxb and wrapnls)

懵懂的女人 提交于 2019-12-04 20:07:04
I have a nls fitting task that I wanted to do with R. My first attempt to do this here and as @Roland pointed out "The point is that complex models are difficult to fit. The more so, the less the data supports the model until it become impossible. You might be able to fit this, if you had extremely good starting values." I can agree with @Roland but if excel can do this fitting why not R cannot do? Basically this fitting can be done with Excel's GRG Nonlinear solver but the process is very time consuming and sometimes fitting is not good. (since there are a lots of data in reality). here is my

Simple Regression Prediction Algorithm in JavaScript

夙愿已清 提交于 2019-12-04 05:56:40
问题 I am trying to do a simple forecast of future profit of an organization based on the past records by using regression. I am following this link. For testing purpose, I have changed the sample data and it produced these results: My actual data will be date and profit, and they will be going up and down rather than in a contiguous increment way. I realized that the method above works for sample data which keep on increasing as the prediction is quite accurate. However, when I changed the data

`nls` fitting error: always reach maximum number of iterations regardless starting values

亡梦爱人 提交于 2019-12-04 01:55:06
问题 Using this parametrization for a growth curve logistic model I created some points with: K =0.7 ; y0=0.01 ; r =0.3 df = data.frame(x= seq(1, 50, by = 5)) df$y = 0.7/(1+((0.7-0.01)/0.01)*exp(-0.3*df$x)) Can someone tell me how can I have a fitting error if create the data with the model starters? fo = df$y ~ K/(1+((K-y0)/y0)*exp(-r*df$x)) model<-nls(fo, start = list(K=0.7, y0=0.01, r=0.3), df, nls.control(maxiter = 1000)) Error in nls(fo, start = list(K = 0.7, y0 = 0.01, r = 0.3), df, nls

Knn Regression in R

倖福魔咒の 提交于 2019-12-03 20:23:32
I am investigating Knn regression methods and later Kernel Smoothing. I wish to demonstrate these methods using plots in R. I have generated a data set using the following code: x = runif(100,0,pi) e = rnorm(100,0,0.1) y = sin(x)+e I have been trying to follow a description of how to use "knn.reg" in 9.2 here: https://daviddalpiaz.github.io/r4sl/k-nearest-neighbors.html#regression grid2=data.frame(x) knn10 = FNN::knn.reg(train = x, test = grid2, y = y, k = 10) My predicted values seem reasonable to me but when I try to plot a line with them on top of my x~y plot I don't get what I'm hoping for