Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void quasinewton(const mat& X, | |
| const mat& y, | |
| mat& parameters, | |
| double computeCost(const mat& X, const mat& y, const mat& parameters), // LeastSquaesCost or logisticCost | |
| vec computeGradient(const mat& X, const mat& y, const mat& parameters), // LeastSquaesGradient or logisticGradient | |
| mat computeHessian(const mat& X, const mat& y, const mat& parameters), // logisticHessian or | |
| string method = "BFGS", // BFGS or BROYDEN or DFP or SR1 | |
| string costs_file = "costs.out", | |
| string parameters_file = "parameters.out", | |
| string step = "armijo", // double as string like "0.01" by default armijo rule |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <armadillo> | |
| #include <bits/stdc++.h> | |
| #include <conio.h> | |
| using namespace std; | |
| double LeastSquaesCost(const mat& X, const mat& y, const mat& parameters) | |
| { | |
| vec tmp(X * parameters - y); | |
| tmp = dot(tmp, tmp); | |
| double s = sum(tmp); |
NewerOlder