Comments (5)
@7sharp9 if you just want to visualize your data and do not care about the fit function that creates the surface, you can just use Chart.Surface
from Plotly.NET as @bvenn suggested. However i think if you are interested in the coefficients that fit the surface, we'd need an equivalent of numpy.polyfit which to my knowledge is not implemented in FSharp.Stats.
As i do not know how your data looks like, here is a example that contains some boilerplate to generate some 2D data that also visualizes the points from the input across the surface:
//---------------------- Generate linearly spaced vector ----------------------
let linspace (min, max, n) =
if n <= 2 then
failwithf "n needs to be larger then 2"
let bw = float (max - min) / (float n - 1.)
Array.init n (fun i -> min + (bw * float i))
//---------------------- Create example data ----------------------
let size = 100
let x = linspace (-2. * Math.PI, 2. * Math.PI, size) // 100 evenly spaced samples between -2π and 2π
let y = linspace (-2. * Math.PI, 2. * Math.PI, size) // 100 evenly spaced samples between -2π and 2π
let f x y = -(5. * x / (x ** 2. + y ** 2. + 1.)) // function to generate z based on x and y: f(x,y) = -(5 * x / (x^2 + y^2 + 1))
let xyz = Array.init size (fun i -> Array.init size (fun j -> x.[j], y.[i], f x.[j] y.[i])) |> Array.concat // generate x,y,z triplets for point plot
let zArray = Array.init size (fun i -> Array.init size (fun j -> f x.[j] y.[i])) // generate z values for surface plot
[
Chart.Point3D(xyz, Marker = Marker.init(Size = 1, Color = Color.fromString "blue"))
Chart.Surface(zData = z, X = x, Y = y)
]
|> Chart.combine
from fsharp.stats.
Do you just want to have some kind of regression or just a smoothed interpolation of each point?
Currently FSharp.Stats is capable of smoothing two-dimensional data only, but if you just need and interpolation and the visualization to be smooth, you can just use a Plotly surface plot. The smooting is performed automatically and may even be adjustable (https://plotly.net/reference/plotly-net-chart3d-chart.html#Surface).
An example can be seen here or here.
from fsharp.stats.
Hi, thanks for the reply, to be honest just looking for any particular solutions, I have a certain amount of data which I want tto plot a surface for, the surface points should not stray away from the data set I have to interpolation like the thin plate spline seem to match my data the best but Ive also managed to replicate in 2d each dimension using tanh or arctan curves. So a F# solution of any sort would suffice for me. F# is th eeasy bits its just figuring out how from samples really.
from fsharp.stats.
If regression is a really close match to my input data I could use that too, but only if the surface is only ever higher than my plotted points, and not by very much.
from fsharp.stats.
Related Issues (20)
- [BUG] documentation issue: Statistical Testing / SAM HOT 8
- [Feature Request] Update all comments according to XML documentation styling HOT 1
- Separate Akima interpolation from cubic spline interpolation HOT 1
- [Duplicate] Brent minimization seems to be duplicated within FSharp.Stats
- Move regularize anywhere more appropriate
- Update Interval module HOT 3
- Addition of Bezier curves HOT 1
- [BUG] In Akima interpolation, the slope at the last point is determined incorrectly. HOT 2
- [Feature Request] Integration procedures for Interpolation and LinearRegression
- Update `Support` member for all probability distributions HOT 2
- Add Wilcoxon Distribution HOT 2
- Hamming distance HOT 1
- Kolmogorov-Smirnov Distribution
- Minkowski distance HOT 4
- Documentation for Savitzky Golay filter
- t-Distributed Stochastic Neighbour Embedding (tSNE)
- Decision trees and random forest
- kNN classification HOT 1
- Documentation request for X² test
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.stats.