Questions tagged [coefficients]

In mathematics, a coefficient is a multiplicative factor in some term of a polynomial, a series or any expression; it is usually a number, but in any case does not involve any variables of the expression.

In mathematics, a coefficient is a multiplicative factor in some term of a polynomial, a series or any expression; it is usually a number, but in any case does not involve any variables of the expression.

495 questions
2
votes
0 answers

Getting negative coef_ when expecting positive?

I am doing a linear regression analysis on a dataset of houses (found here: https://www.kaggle.com/shree1992/housedata). I have the following code(see image1): image1 The image shows that when I print the average price for each number of bedrooms…
2
votes
1 answer

Trying to extract coefficients from glmnet model returns NULL or "type must be either "raw" or "prob"" error

I am running a glmnet model in caret on the built-in infert dataset, e.g., infert_y <- factor(infert$case) %>% plyr::revalue(c("0"="control", "1"="case")) infert_x <- subset(infert, select=-case) new.x <- model.matrix(~., infert_x) # Create…
Mel
  • 700
  • 6
  • 31
2
votes
2 answers

scipy.interpolate.make_interp_spline how to retrieve all the coefficients?

I have the following program: nknots = 4 x_i = [0, 1, 2, 3] y_i = [1, np.exp(1), np.exp(2), np.exp(3)] coeff = interpolate.make_interp_spline(x_i, y_i, bc_type="natural") I want to construct a cubic spline using the knots whose coordinates are…
2
votes
1 answer

Why do we use the smooth variable to calculate dice_coef or IoU in keras model?

I want to calculate the loss function of my keras model based on dice_coef and I found this expression on the internet: smooth = 1. def dice_coef(y_true, y_pred): y_true_f = K.flatten(y_true) y_pred_f = K.flatten(y_pred) intersection =…
baddy
  • 369
  • 1
  • 3
  • 23
2
votes
1 answer

Relevel factor and glm with effect coding

I'm having trouble understanding effect coding with glm. As an example: data('mpg') mpg$trans = as.factor(mpg$trans) levels(mpg$trans) [1] "auto(av)" "auto(l3)" "auto(l4)" "auto(l5)" "auto(l6)" "auto(s4)" "auto(s5)" "auto(s6)" …
W. Mooi
  • 119
  • 1
  • 3
  • 11
2
votes
3 answers

Improve efficiency of fitting many models

Thanks to those who helped me with previous questions about coefficients and p values from many models. Now, I can get all coefficients, p values, and AIC values from many models. md <- "mpg ~ cyl" xlist <- c("disp", "hp", "am") n <-…
Zhiqiang Wang
  • 6,206
  • 2
  • 13
  • 27
2
votes
1 answer

How to apply short time series linear regression over a large time series DataFrame

I have a large time series data set covering multiple years with daily rates. I'm trying add two extra columns which include the Y intercept and the coefficient of x or slope based on the previous 10 days of rates. In excel, I use the linest…
2
votes
1 answer

How to print coefficient and exponent separate from each other in python?

I would like to grab from a very large/small number (e.g., 1.324e-07) the leading coefficient by itself (1.324) and then the exponent by itself (-7) so I can send them to my .tex file as 1.324 \times 10^{-7}. I'm writing a small script to generate…
Chad File
  • 23
  • 3
2
votes
0 answers

How to format line on scatter plot

I need the line to reach the end corners of the graph, and also need to change the color of the line to red. My code: plt.figure(), plt.subplot(211) plt.scatter(df.NOX, df.PTRATIO) b, m = polyfit(x, y, 1) plt.plot(x, y, '.' ) plt.plot(x, b + m *…
2
votes
0 answers

How do you find the coefficients of a Polynomail SVM in scikit-learn and what is the gamma?

coef_ : array, shape = [n_class * (n_class-1) / 2, n_features] Weights assigned to the features (coefficients in the primal problem). This is only available in the case of a linear kernel. coef_ is a readonly property derived from dual_coef_ and…
AturSams
  • 7,568
  • 18
  • 64
  • 98
2
votes
0 answers

Logistic regression coefficients

I am doing logistic regression with 3 attributes. According to my data set I am expecting all coefficients to be positive. But it gives me both positive and negative coefficients. Is it possible to have all positive coefficients using logistic…
jenyK
  • 71
  • 6
2
votes
1 answer

Python fitting a curve with coeficents errors

I need to fit a curve over a set of data and also need the uncertainty - or errors - of the coefficients, for exemple: fitting ax^2+bx+c, i need the values: a+-da, b+-db and c+-dc. Where da,db and dc are the uncertaints. I already tried polyfit and…
2
votes
1 answer

How to adjust coefficients for nonlinear curve fit using non-standard polynomial function in R

I am attempting to perform a polynomial regression on a set of data, whose plot looks like this However, every time I perform this regression, I get a low R squared value even though the points seem tightly packed around a line. My guess for why…
2
votes
0 answers

save and use the bootstrapped coefficients, boot library in r

I want to save and use later the bootstrapped regression coefficients of a regression model using the library 'boot' in R. In the example below, I want to be able to see and use the 1,000 bootstrapped coefficients for 'wt'. Is there a way to do…
Spyros
  • 56
  • 7
2
votes
1 answer

Coefficient values in Multiple Linear Regression using Neural Networks

Let's say I have an input dataset of size n = 100 observations, m = 5 features where the last feature is the dependent variable and rest four are independent variable. It is a regression problem, which I intend to solve using a Neural Network. After…