[Solved] Curve Fits more accurate than Cubic Spline ?

Just starting out? Need help? Post your questions and find answers here.
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

[Solved] Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

is there a Curve Fit equation more accurate in regards to X and Y Data pairs
than a Cubic Spline Curve Fit ??

Reason : Cubic Splines are not a good enough Fit to Data i'm trying to simulate

TSpline, BSpline, CSpline, Bezier , others ...etc ??

Anyone have PureBasic Code for Curve Fits they would share ?
Last edited by VB6_to_PBx on Mon Mar 04, 2019 8:01 pm, edited 1 time in total.
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Curve Fits more accurate than Cubic Spline ?

Post by skywalk »

How do you define accuracy in your curve fits?
Do you have a csv file of xy data for the many points(curve fitted) vs a smaller data set(original)?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Curve Fits more accurate than Cubic Spline ?

Post by STARGÅTE »

Do you want to fit your data with an equation, a law? Than you have to look for your law: Exp(), Sin(), Sqr() ...
Do you want to interpolate your data, with a polynom? In the easiest case linear.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

STARGÅTE wrote:Do you want to fit your data with an equation, a law? Than you have to look for your law: Exp(), Sin(), Sqr() ...
Do you want to interpolate your data, with a polynom? In the easiest case linear.
skywalk wrote: How do you define accuracy in your curve fits?
Do you have a csv file of xy data for the many points(curve fitted) vs a smaller data set(original)?
thanks for the quick Replies ... didn't think i'd get so quick a response ,
i'll Post or Link a X,Y Data File in csv format

Polynomial and a Linear Spline i've tried , and are not close enough fit
a Cubic Spline is closer , but still not close enough

i'm testing so far only 33 X Y Data pairs to fit 1300 to 1600 Data points to minimum of 5 decimal places

i've writen a Program that generates minimum of 1300+ points of Data in 5 to 6 decimal places accuracy
and i'm trying to reverse-engineer the Data of that Program back into original accuracy over 1300+ points .

i'm trying to do this without necessarily having to add a bunch more than 33 XY Data points
in other words, trying to keep somewhere around 130 or less XY Data pairs that will accurately simulate 1300+ real points of Data to 5 r more decimal places

i thought i would Post a Thread here to see if anyone know of a Spline or anyother Curve Fit equations
that might use 30 to 100 or even as high as 200 XY Data pairs to simulate real 1300 Data point values to 5 or 6 decimal places minimum.

dividing up 1300 points into 100 or so Cubic Spline XY Data pairs is what i was going to test next
while waiting on anyone in this Forum to Reply with a better more accurate Solution

Thanks for interest + any Code to test out
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Curve Fits more accurate than Cubic Spline ?

Post by DarkDragon »

For every type of spline there are two possibilities:
  1. use the data as control points (curve does not go through the points)
  2. interpolate the data points (curve goes through it)
However with many points, you'll experience the problem of overfitting, which means that the curve will create waves with unwanted huge waves. B-splines try to limit these for example by limiting the influence of control points (or better said knots).
bye,
Daniel
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Curve Fits more accurate than Cubic Spline ?

Post by skywalk »

You just need the XY pairs for the region of the curve that deviates from your attempted curve fit.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

However with many points, you'll experience the problem of overfitting,
which means that the curve will create waves with unwanted huge waves.
B-splines try to limit these for example by limiting the influence of control points (or better said knots).
which means that the curve will create waves with unwanted huge waves.

Yes, that's exactly what is happening !!! ... but using lesser XY Data pairs does not help out either :evil:

with a Cubic Spline , it fits perfect in some portions and then wildly deviates in other portions... then comes back again in the next portions with a perfect fit to 6+ decimal point places

i'm trying to correct the deviation section problems with a more accurate Curve Fit equation or Method
i have B-Spline equations in VB6.0 , but must convert to PureBasic plus add all the extra XY data Pair inputs
as VB6 version only has 5 XY Data pairs

so you think B-Spline might help ??

i have VB6 T and C Spline equations , but they also have 5 XY Data pair input boxes, so it takes time to code for 30+ XY Pairs
and test these different Splines in PureBasic or VB6
You just need the XY pairs for the region of the curve that deviates from your attempted curve fit.
thats same idea i've had .. just did not yet get to test that out too :(
will start coding all this in ....
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

well none of the various Splines worked at all :(
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Curve Fits more accurate than Cubic Spline ?

Post by skywalk »

Can you cut and paste some XY values?
Better yet, embed them in a DataSection?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

skywalk wrote:Can you cut and paste some XY values?
Better yet, embed them in a DataSection?
i placed actual Data files in Excel .XLS format
with .PNG picture files
and .TXT files
of problems fitting Cubic Spline Data -VS- Real Data
in this ZIP File Link :

http://www.mediafire.com/file/0d4fm4rns ... s.zip/file

sorry i have not yet coded a PureBasic program
to use XY Pairs in a DataSection to Post or include in the ZIP file

Please read the README.TXT file first .
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Curve Fits more accurate than Cubic Spline ?

Post by skywalk »

As I suspected, you have discontinuities in the data set that cannot reasonably be described with simple polynomials or cubics. You have to create a model that emits data for these crossover points.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

skywalk wrote:As I suspected, you have discontinuities in the data set that cannot reasonably be described with simple polynomials or cubics. You have to create a model that emits data for these crossover points.
Yes ,
and it appears it would take a ton of XY Data Pairs to get a thorough accurate Fit at each point ,
in doing so , defeats the purpose of Curve Fitting
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: Curve Fits more accurate than Cubic Spline ?

Post by jack »

hello VB6_to_PBx
there's program called Eureqa https://www.nutonian.com/download/eureq ... -download/ that tries to find a symbolic expression to a given set of data points
who knows, it may help in your situation.
the program initially was free, but not anymore, and I haven't run the program since then, there's however a 30 day trial version for download.
[edit]
Eureqa was bought out by https://www.datarobot.com/

youtube demo https://www.youtube.com/watch?time_cont ... hC1Qb-PQ5Q
https://www.youtube.com/watch?v=k7GCqfV5Uk4
https://www.youtube.com/watch?time_cont ... So6eeDsFlE
User avatar
VB6_to_PBx
Enthusiast
Enthusiast
Posts: 627
Joined: Mon May 09, 2011 9:36 am

Re: Curve Fits more accurate than Cubic Spline ?

Post by VB6_to_PBx »

jack wrote:hello VB6_to_PBx
there's program called Eureqa https://www.nutonian.com/download/eureq ... -download/ that tries to find a symbolic expression to a given set of data points
who knows, it may help in your situation.
the program initially was free, but not anymore, and I haven't run the program since then, there's however a 30 day trial version for download.
[edit]
Eureqa was bought out by https://www.datarobot.com/

youtube demo https://www.youtube.com/watch?time_cont ... hC1Qb-PQ5Q
https://www.youtube.com/watch?v=k7GCqfV5Uk4
https://www.youtube.com/watch?time_cont ... So6eeDsFlE
thanks Jack for the Links ,

i've downloaded it , but have not run it yet,
and it might give me some insights , but not completely solve what i want ?
 
PureBasic .... making tiny electrons do what you want !

"With every mistake we must surely be learning" - George Harrison
alter Mann
User
User
Posts: 39
Joined: Fri Oct 17, 2014 8:52 pm

Re: Curve Fits more accurate than Cubic Spline ?

Post by alter Mann »

How do you choose the x-values, where the splines should start and end?
Post Reply