regression

How to implement the Softmax derivative independently from any loss function?

前提是你 提交于 2019-12-03 02:26:52
For a neural networks library I implemented some activation functions and loss functions and their derivatives. They can be combined arbitrarily and the derivative at the output layers just becomes the product of the loss derivative and the activation derivative. However, I failed to implement the derivative of the Softmax activation function independently from any loss function. Due to the normalization i.e. the denominator in the equation, changing a single input activation changes all output activations and not just one. Here is my Softmax implementation where the derivative fails the

forward stepwise regression

痞子三分冷 提交于 2019-12-03 02:16:49
In R stepwise forward regression, I specify a minimal model and a set of variables to add (or not to add): min.model = lm(y ~ 1) fwd.model = step(min.model, direction='forward', scope=(~ x1 + x2 + x3 + ...)) Is there any way to specify using all variables in a matrix/data.frame, so I don't have to enumerate them? Examples to illustrate what I'd like to do, but they don't work: # 1 fwd.model = step(min.model, direction='forward', scope=(~ ., data=my.data.frame)) # 2 min.model = lm(y ~ 1, data=my.data.frame) fwd.model = step(min.model, direction='forward', scope=(~ .)) scope expects (quoting the

Curve Fitting 3D data set

隐身守侯 提交于 2019-12-03 01:38:47
The curve-fitting problem for 2D data is well known (LOWESS, etc.) but given a set of 3D data points, how do I fit a 3D curve (eg. a smoothing/regression spline) to this data? MORE: I'm trying to find a curve, fitting the data provided by vectors X,Y,Z which have no known relation. Essentially, I have a 3D point cloud, and need to find a 3D trendline. MORE: I apologize for the ambiguity. I tried several approaches (I still haven't tried modifying the linear fit) and a random NN seems to work out best. I.e., I randomly pick a point from the point cloud, find the centroid of it's neighbors

sklearn LogisticRegression without regularization

吃可爱长大的小学妹 提交于 2019-12-03 01:36:11
Logistic regression class in sklearn comes with L1 and L2 regularization. How can I turn off regularization to get the "raw" logistic fit such as in glmfit in Matlab? I think I can set C = large number but I don't think it is wise. see for more details the documentation http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html#sklearn.linear_model.LogisticRegression Yu Chen Yes, choose as large a number as possible. In regularization, the cost function includes a regularization expression, and keep in mind that the C parameter in sklearn regularization is

Using the glmulti package in R for exhaustive search multiple regression for akaike weights

一个人想着一个人 提交于 2019-12-03 00:36:10
I was wondering if someone could help me understand why I am getting an error message when I enter a script into R. For abit of background information I am looking into the effect 6 different variables (which I think is 63 combinations or models) (X) have on gross primary and net ecosystem production (Y) seperatly at different spatial scales for my environmental science honours project. I have decided to use exhaustive search multiple regression analysis with akaikes information criterion (AIC) to try and find a group of models for best fit. (and hierarchical partitioning to compare variance

How to correctly use scikit-learn's Gaussian Process for a 2D-inputs, 1D-output regression?

倖福魔咒の 提交于 2019-12-02 23:56:21
Prior to posting I did a lot of searches and found this question which might be exactly my problem. However, I tried what is proposed in the answer but unfortunately this did not fix it, and I couldn't add a comment to request further explanation, as I am a new member here. Anyway, I want to use the Gaussian Processes with scikit-learn in Python on a simple but real case to start (using the examples provided in scikit-learn's documentation). I have a 2D input set (8 couples of 2 parameters) called X . I have 8 corresponding outputs, gathered in the 1D-array y . # Inputs: 8 points X = np.array(

Multiple-output Gaussian Process regression in scikit-learn

谁都会走 提交于 2019-12-02 23:30:20
I am using scikit learn for Gaussian process regression (GPR) operation to predict data. My training data are as follows: x_train = np.array([[0,0],[2,2],[3,3]]) #2-D cartesian coordinate points y_train = np.array([[200,250, 155],[321,345,210],[417,445,851]]) #observed output from three different datasources at respective input data points (x_train) The test points (2-D) where mean and variance/standard deviation need to be predicted are: xvalues = np.array([0,1,2,3]) yvalues = np.array([0,1,2,3]) x,y = np.meshgrid(xvalues,yvalues) #Total 16 locations (2-D) positions = np.vstack([x.ravel(), y

Display regression equation in seaborn regplot [duplicate]

怎甘沉沦 提交于 2019-12-02 22:02:37
This question already has an answer here: How to get the numerical fitting results when plotting a regression in seaborn? 2 answers Does anyone know how to display the regression equation in seaborn using sns.regplot or sns.jointplot? regplot doesn't seem to have any parameter that you can be pass to display regression diagnostics, and jointplot only displays the pearson R^2, and p-value. I'm looking for a way to see the slope coefficient, standard error, and intercept as well. Thanks In 2015, the lead developer for seaborn replied to a feature request asking for access to the statistical

How to obtain RMSE out of lm result?

别说谁变了你拦得住时间么 提交于 2019-12-02 21:06:17
I know there is a small difference between $sigma and the concept of root mean squared error . So, i am wondering what is the easiest way to obtain RMSE out of lm function in R ? res<-lm(randomData$price ~randomData$carat+ randomData$cut+randomData$color+ randomData$clarity+randomData$depth+ randomData$table+randomData$x+ randomData$y+randomData$z) length(coefficients(res)) contains 24 coefficient, and I cannot make my model manually anymore. So, how can I evaluate the RMSE based on coefficients derived from lm ? Residual sum of squares: RSS <- c(crossprod(res$residuals)) Mean squared error:

Linear regression with pandas dataframe

拥有回忆 提交于 2019-12-02 21:03:50
I have a dataframe in pandas that I'm using to produce a scatterplot, and want to include a regression line for the plot. Right now I'm trying to do this with polyfit. Here's my code: import pandas as pd import matplotlib import matplotlib.pyplot as plt from numpy import * table1 = pd.DataFrame.from_csv('upregulated_genes.txt', sep='\t', header=0, index_col=0) table2 = pd.DataFrame.from_csv('misson_genes.txt', sep='\t', header=0, index_col=0) table1 = table1.join(table2, how='outer') table1 = table1.dropna(how='any') table1 = table1.replace('#DIV/0!', 0) # scatterplot plt.scatter(table1['log2