I am trying to understand if 2 parabolas can be parallel? If yes how to plot them using python.
Once the parabolas have been plotted, I need to understand what non-linear transformations should be applied on them to make them linearly separable
I am trying to solve this assignment end to end.
Related
I'm currently struggling to wrap my head around how multi-linear regression could be done to find separate sets of linear models in a single data set. I can perform regression on single data set for a single regressor and coef with no problem, but what if there are a known-number of lines existing in a single data space?
My first approach was to use hierarchical clustering to identify the points using ML first, but it doesn't seem to capture individual
cluster variance in Euclidean space as expected. My second trial was KMeans, which still relies on Euclidean distance so it creates clusters with radii. My last thought process led to Kmedian, but at this point I was wondering what other people might think regarding this problem.
If this is the right direction, I know I would have to project points in a better space(i.e. an axis that captures more-or most- variance) before I apply these methods.
I would appreciate any comments or input in any shape or form.
Thank you,
3-line summary:
Linear regression on dataset with multiple lines
Clustering first, then multiple single linear regression?
or have you guys come across a module for this such thing?
I would truly appreciate any insights;
I require a python solution to force a polynomial to end at a specific point. I have read the solutions offered here: How to do a polynomial fit with fixed points to a similar question but have been unable to get any of these methods working on my data set as are not defining end points but locations to for a polynomial to pass through.
I therefore require a solution to force a polynomial curve to end at a specific location.
To put this in context the example that I need this for is shown in the image below, I require a line of best fit for the data below, the green points represent the raw data and the pink points are the mean of the green points for every x value. The best fit should be a 3rd order polynomial until the data becomes a horizontal linear line. The black line is my current attempt at a line of best fit using np.ployfit(), I have defined the polynomial to only plot until the location where I would then start the linear best fit line but as you can see the tail of the polynomial is far to low and hence I want to force it to end / go through a specific point.
I am open to all options to get a nice mathematically sensible best fit as have been banging my head against this problem for too long now.
Using a logistic sigmoid instead of a polynomial:
Formula and parameters, generated from some of your sample data points(taken from the picture):
where S(x) is the sigmoid function.
A distinct approach, since you seem to want to identify outliers in the horizontal dimension.
Stratify your data by power, say into 10-kW intervals, so that each interval contains 'enough' points to use some robust estimator of their dispersion. In each stratum discard upper extreme observations until the robust estimate falls to a stable value. Now use the maximum values for the strata as the criteria against which to gauge whether any given device is to be regarded as 'inefficient'.
I have multiple sets of data, each of which have a roughly sinusoidal shape. I have attached a photo of one such data Roughly sinusoidal data
I want to fit an equation of the form y = Asin(kx+b)+mx+c. Basically the data is a sine wave with a linear increase. Is there any simple way of doing this, preferably without toolboxes as I have about 20 of these data to sort through?
Thank you.
I am using matlab, however I am open to python too :).
What you want to do is to use regression in your function to fit the data.
One way to do this is to apply Non-linear least squares to find the parameters that minimize the square error for your function.
Take a look at the matlab function lsqcurvefit (http://es.mathworks.com/help/optim/ug/lsqcurvefit.html)
Given some coordinates in 3D (x-, y- and z-axes), what I would like to do is to get a polynomial (fifth order). I know how to do it in 2D (for example just in x- and y-direction) via numpy. So my question is: Is it possible to do it also with the third (z-) axes?
Sorry if I missed a question somewhere.
Thank you.
Numpy has functions for multi-variable polynomial evaluation in the polynomial package -- polyval2d, polyval3d -- the problem is getting the coefficients. For fitting, you need the polyvander2d, polyvander3d functions that create the design matrices for the least squares fit. The multi-variable polynomial coefficients thus determined can then be reshaped and used in the corresponding evaluation functions. See the documentation for those functions for more details.
I have an experimental data, which is piecewise continuous, and each part should fit linearly. However, I would like to fit it without knowing where exactly are the knots (so the points where the slope is changing), since its not easy to determine them manually.
So far I found the advice of using py-earth for this task, but couldn't understand how to implement it; that is, having just a list of variables for X and Y, how to be able to do such piecewise linear regression.
Could anybody give me advice on how to do that?
UPD: Turned out, the problem was because of the different format of array. "X=numpy.array([X]).T" for my arrays solved it, and now py_earth is working. However, it's to "rough", showing one single line for several knots. Can anybody suggest some other solution for the piecewise linear regression?