ProportionalHazardsNewtonRaphson Class |
Namespace: Accord.Statistics.Models.Regression.Fitting
public class ProportionalHazardsNewtonRaphson : ISupervisedLearning<ProportionalHazards, Tuple<double[], double>, int>, ISupervisedLearning<ProportionalHazards, Tuple<double[], double>, bool>, IConvergenceLearning
The ProportionalHazardsNewtonRaphson type exposes the following members.
Name | Description | |
---|---|---|
ProportionalHazardsNewtonRaphson |
Constructs a new Newton-Raphson learning algorithm
for Cox's Proportional Hazards models.
| |
ProportionalHazardsNewtonRaphson(ProportionalHazards) |
Constructs a new Newton-Raphson learning algorithm
for Cox's Proportional Hazards models.
|
Name | Description | |
---|---|---|
ComputeBaselineFunction |
Gets or sets a value indicating whether an estimate
of the baseline hazard function should be computed
at the end of the next iterations.
| |
ComputeStandardErrors |
Gets or sets a value indicating whether standard
errors should be computed at the end of the next
iterations.
| |
CurrentIteration |
Gets or sets the number of performed iterations.
| |
Estimator |
Gets or sets the hazard estimator that should be used by the
proportional hazards learning algorithm. Default is to use
BreslowNelsonAalen.
| |
Gradient |
Gets the Gradient vector computed in
the last Newton-Raphson iteration.
| |
HasConverged |
Gets or sets whether the algorithm has converged.
| |
Hessian |
Gets the Hessian matrix computed in
the last Newton-Raphson iteration.
| |
Iterations | Obsolete.
Please use MaxIterations instead.
| |
Lambda |
Gets or sets the smoothing factor used to avoid numerical
problems in the beginning of the training. Default is 0.1.
| |
MaxIterations |
Gets or sets the maximum number of iterations
performed by the learning algorithm.
| |
Model |
Gets or sets the regression model being learned.
| |
Normalize |
Gets or sets a value indicating whether the Cox model should
be computed using the mean-centered version of the covariates.
Default is true.
| |
Parameters |
Gets the total number of parameters in the model.
| |
Previous |
Gets the previous values for the coefficients which were
in place before the last learning iteration was performed.
| |
Solution |
Gets the current values for the coefficients.
| |
Ties |
Gets or sets the ties handling method to be used by the
proportional hazards learning algorithm. Default is to use
Efron's method.
| |
Token |
Gets or sets a cancellation token that can be used to
stop the learning algorithm while it is running.
| |
Tolerance |
Gets or sets the maximum absolute parameter change detectable
after an iteration of the algorithm used to detect convergence.
Default is 1e-5.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Learn(TupleDouble, Double, SurvivalOutcome, Double) |
Learns a model that can map the given inputs to the given outputs.
| |
Learn(TupleDouble, Double, Boolean, Double) |
Learns a model that can map the given inputs to the given outputs.
| |
Learn(TupleDouble, Double, Int32, Double) |
Learns a model that can map the given inputs to the given outputs.
| |
Learn(Double, Double, SurvivalOutcome, Double) |
Learns a model that can map the given inputs to the given outputs.
| |
Learn(Double, Double, Int32, Double) |
Learns a model that can map the given inputs to the given outputs.
| |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Run(Double, SurvivalOutcome) | Obsolete.
Runs the Newton-Raphson update for Cox's hazards learning until convergence.
| |
Run(Double, Int32) | Obsolete.
Runs the Newton-Raphson update for Cox's hazards learning until convergence.
| |
Run(Double, Double) | Obsolete.
Runs the Newton-Raphson update for Cox's hazards learning until convergence.
| |
Run(Double, Double, SurvivalOutcome) | Obsolete.
Runs the Newton-Raphson update for Cox's hazards learning until convergence.
| |
Run(Double, Double, Int32) | Obsolete.
Runs the Newton-Raphson update for Cox's hazards learning until convergence.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(Type) | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) | |
ToT | Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.) |
// Let's say we have the following survival problem. Each row in the // table below represents a patient under care in a hospital. The first // colum represents their age (a single feature, but there could have // been many like age, height, weight, etc), the time until an event // has happened (like, for example, unfortunatey death) and the event // outcome (i.e. what has exactly happened after this amount of time, // has the patient died or did he simply leave the hospital and we // couldn't get more data about him?) object[,] data = { // input time until outcome // (features) event happened (what happened?) { 50, 1, SurvivalOutcome.Censored }, { 70, 2, SurvivalOutcome.Failed }, { 45, 3, SurvivalOutcome.Censored }, { 35, 5, SurvivalOutcome.Censored }, { 62, 7, SurvivalOutcome.Failed }, { 50, 11, SurvivalOutcome.Censored }, { 45, 4, SurvivalOutcome.Censored }, { 57, 6, SurvivalOutcome.Censored }, { 32, 8, SurvivalOutcome.Censored }, { 57, 9, SurvivalOutcome.Failed }, { 60, 10, SurvivalOutcome.Failed }, }; // Note: Censored means that we stopped recording data for that person, // so we do not know what actually happened to them, except that things // were going fine until the point in time appointed by "time to event" // Parse the data above double[][] inputs = data.GetColumn(0).ToDouble().ToJagged(); double[] time = data.GetColumn(1).ToDouble(); SurvivalOutcome[] output = data.GetColumn(2).To<SurvivalOutcome[]>(); // Create a new PH Newton-Raphson learning algorithm var teacher = new ProportionalHazardsNewtonRaphson() { ComputeBaselineFunction = true, ComputeStandardErrors = true, MaxIterations = 100 }; // Use the learning algorithm to infer a Proportional Hazards model ProportionalHazards regression = teacher.Learn(inputs, time, output); // Use the regression to make predictions (problematic) SurvivalOutcome[] prediction = regression.Decide(inputs); // Use the regression to make score estimates double[] score = regression.Score(inputs); // Use the regression to make probability estimates double[] probability = regression.Probability(inputs);