Statistical Analysis with Swift by Jimmy Andersson

Statistical Analysis with Swift by Jimmy Andersson

Author:Jimmy Andersson
Language: eng
Format: epub
ISBN: 9781484277652
Publisher: Apress


do {

let regressor = try MultipleLinearRegression(

from: points,

data: \.x, \.y,

target: \.z

)

let observed = points[42]

let prediction = regressor.predict(x: observed)

print(

"""

f(x) = \(regressor)

Prediction for (\(observed.x), \(observed.y))

\(prediction)

Observed value for (\(observed.x), \(observed.y))

\(observed.z)

"""

)

}

catch {

print("An error was thrown: \(error)")

}

// Prints:

// f(x) = 1.010083366089924 * x_1 –

// 0.9873800441120847 * x_2 - 0.23672317614604843

// Prediction for (3.0, 3.0)

// -0.16861321021253062

// Observed value for (3.0, 3.0)

// -0.379395117657068



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.