ProportionalHazards Class |
Namespace: Accord.Statistics.Models.Regression
[SerializableAttribute] public sealed class ProportionalHazards : BinaryLikelihoodClassifierBase<Tuple<double[], double>>
The ProportionalHazards type exposes the following members.
Name | Description | |
---|---|---|
ProportionalHazards |
Creates a new Cox Proportional-Hazards Model.
| |
ProportionalHazards(Int32) |
Creates a new Cox Proportional-Hazards Model.
| |
ProportionalHazards(Int32, IUnivariateDistribution) |
Creates a new Cox Proportional-Hazards Model.
|
Name | Description | |
---|---|---|
BaselineHazard |
Gets the baseline hazard function, if specified.
| |
Coefficients |
Gets the coefficient vector, in which the
first value is always the intercept value.
| |
Inputs | Obsolete.
Gets the number of inputs handled by this model.
| |
Intercept |
Gets or sets the intercept (bias) for the regression model.
| |
NumberOfClasses |
Gets the number of classes expected and recognized by the classifier.
(Inherited from ClassifierBaseTInput, TClasses.) | |
NumberOfInputs |
Gets the number of inputs accepted by the model.
(Inherited from TransformBaseTInput, TOutput.) | |
NumberOfOutputs |
Gets the number of outputs generated by the model.
(Inherited from TransformBaseTInput, TOutput.) | |
Offsets | Obsolete.
Gets the mean vector used to center observations before computations.
| |
StandardErrors |
Gets the standard errors associated with each
coefficient during the model estimation phase.
|
Name | Description | |
---|---|---|
ChiSquare(Double, Double, SurvivalOutcome) |
The likelihood ratio test of the overall model, also called the model chi-square test.
| |
ChiSquare(Double, Double, Int32) |
The likelihood ratio test of the overall model, also called the model chi-square test.
| |
Clone |
Creates a new Cox's Proportional Hazards that is a copy of the current instance.
| |
Compute(Double) | Obsolete.
Obsolete. Please use the Probability(input) method instead.
| |
Compute(Double) | Obsolete.
Obsolete. Please use the Probability(input) method instead.
| |
Compute(Double) | Obsolete.
Obsolete. Please use the Probability(input) method instead.
| |
Compute(Double, Double) | Obsolete.
Obsolete. Please use the Probability(input, time) method instead.
| |
Compute(Double, Double) | Obsolete.
Computes the model output for the given input vector.
| |
Decide(TInput) |
Computes a class-label decision for a given input.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Decide(TInput) |
Computes class-label decisions for a given set of input vectors.
(Inherited from ClassifierBaseTInput, TClasses.) | |
Decide(Double) |
Computes class-label decisions for each vector in the given input.
| |
Decide(Double) |
Computes class-label decisions for each vector in the given input.
| |
Decide(TInput, Boolean) |
Computes class-label decisions for the given input.
(Inherited from BinaryClassifierBaseTInput.) | |
Decide(TInput, Boolean) |
Computes a class-label decision for a given input.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Decide(Double, Double) |
Computes class-label decisions for each vector in the given input.
| |
Decide(Double, Double) |
Computes class-label decisions for each vector in the given input.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetConfidenceInterval |
Gets the 95% confidence interval for the
Hazard Ratio for a given coefficient.
| |
GetDeviance |
Gets the Deviance for the model.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetHazardRatio |
Gets the Hazard Ratio for a given coefficient.
| |
GetLogHazardRatio |
Gets the Log-Hazard Ratio between two observations.
| |
GetLogLikelihoodRatio |
Gets the Log-Likelihood Ratio between two models.
| |
GetPartialLogLikelihood(Double, SurvivalOutcome) |
Gets the Partial Log-Likelihood for the model.
| |
GetPartialLogLikelihood(Double, Int32) |
Gets the Partial Log-Likelihood for the model.
| |
GetPartialLogLikelihood(Double, Double, SurvivalOutcome) |
Gets the Partial Log-Likelihood for the model.
| |
GetPartialLogLikelihood(Double, Double, Int32) |
Gets the Partial Log-Likelihood for the model.
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetWaldTest |
Gets the Wald Test for a given coefficient.
| |
LogLikelihood(TInput) |
Predicts a class label vector for the given input vector, returning the
log-likelihood that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihood(TInput) |
Predicts a class label vector for the given input vector, returning the
log-likelihood that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihood(Double) |
Predicts a class label for the given input vector, returning the
log-likelihood that the input vector belongs to its predicted class.
| |
LogLikelihood(Double) |
Predicts a class label vector for the given input vectors, returning the
log-likelihood that the input vector belongs to its predicted class.
| |
LogLikelihood(Double) |
Predicts a class label vector for the given input vectors, returning the
log-likelihood that the input vector belongs to its predicted class.
| |
LogLikelihood(TInput, Boolean) |
Predicts a class label vector for the given input vector, returning the
log-likelihood that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihood(TInput, Int32) |
Predicts a class label for each input vector, returning the
log-likelihood that each vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihood(Double, Double) |
Predicts a class label vector for the given input vectors, returning the
log-likelihood that the input vector belongs to its predicted class.
| |
LogLikelihood(Double, Double) |
Predicts a class label vector for the given input vectors, returning the
log-likelihood that the input vector belongs to its predicted class.
| |
LogLikelihood(TupleDouble, Double, Double) |
Predicts a class label vector for the given input vectors, returning the
log-likelihood that the input vector belongs to its predicted class.
(Overrides BinaryLikelihoodClassifierBaseTInputLogLikelihood(TInput, Double).) | |
LogLikelihood(TInput, Boolean, Double) |
Predicts a class label for each input vector, returning the
log-likelihood that each vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput) |
Computes the log-likelihood that the given input
vector belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput) |
Computes the log-likelihoods that the given input
vectors belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput, Boolean) |
Predicts a class label vector for the given input vector, returning the
log-likelihoods of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput, Double) |
Computes the log-likelihood that the given input
vector belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput, Double) |
Computes the log-likelihoods that the given input
vectors belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput, Int32) |
Predicts a class label vector for each input vector, returning the
log-likelihoods of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput, Boolean, Double) |
Predicts a class label vector for the given input vector, returning the
log-likelihoods of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
LogLikelihoods(TInput, Boolean, Double) |
Predicts a class label vector for each input vector, returning the
log-likelihoods of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput) |
Computes the probabilities that the given input
vector belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput) |
Computes the probabilities that the given input
vectors belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput, Boolean) |
Predicts a class label vector for the given input vector, returning the
probabilities of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput, Double) |
Computes the probabilities that the given input
vector belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput, Double) |
Computes the probabilities that the given input
vectors belongs to each of the possible classes.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput, Int32) |
Predicts a class label vector for each input vector, returning the
probabilities of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput, Boolean, Double) |
Predicts a class label vector for the given input vector, returning the
probabilities of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probabilities(TInput, Boolean, Double) |
Predicts a class label vector for each input vector, returning the
probabilities of the input vector belonging to each possible class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probability(TInput) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probability(TInput) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probability(Double) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
| |
Probability(Double) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
| |
Probability(Double) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
| |
Probability(TInput, Boolean) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probability(TInput, Double) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probability(TInput, Int32) |
Predicts a class label for each input vector, returning the
probability that each vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Probability(Double, Double) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
| |
Probability(Double, Double) |
Predicts a class label for the given input vector, returning the
probability that the input vector belongs to its predicted class.
| |
Probability(TInput, Boolean, Double) |
Predicts a class label for each input vector, returning the
probability that each vector belongs to its predicted class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Score(TInput) |
Computes a numerical score measuring the association between
the given input vector and its most strongly
associated class (as predicted by the classifier).
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Score(TInput) |
Computes a numerical score measuring the association between
the given input vector and its most strongly
associated class (as predicted by the classifier).
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Score(Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
| |
Score(Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
| |
Score(TInput, Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Score(TInput, Boolean) |
Predicts a class label for the input vector, returning a
numerical score measuring the strength of association of the
input vector to its most strongly related class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Score(TInput, Boolean) |
Predicts a class label for each input vector, returning a
numerical score measuring the strength of association of the
input vector to the most strongly related class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Score(Double, Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
| |
Score(Double, Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
| |
Score(TInput, Boolean, Double) |
Predicts a class label for each input vector, returning a
numerical score measuring the strength of association of the
input vector to the most strongly related class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput) |
Computes a numerical score measuring the association between
the given input vector and each class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput) |
Computes a numerical score measuring the association between
the given input vector and each class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput, Boolean) |
Predicts a class label vector for the given input vector, returning a
numerical score measuring the strength of association of the input vector
to each of the possible classes.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput, Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput, Boolean) |
Predicts a class label vector for each input vector, returning a
numerical score measuring the strength of association of the input vector
to each of the possible classes.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput, Double) |
Computes a numerical score measuring the association between
the given input vector and each class.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput, Boolean, Double) |
Predicts a class label vector for the given input vector, returning a
numerical score measuring the strength of association of the input vector
to each of the possible classes.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Scores(TInput, Boolean, Double) |
Predicts a class label vector for each input vector, returning a
numerical score measuring the strength of association of the input vector
to each of the possible classes.
(Inherited from BinaryScoreClassifierBaseTInput.) | |
Survival |
Computes the model's baseline survival function. This method
simply calls the ComplementaryDistributionFunction(Double)
of the BaselineHazard function.
| |
ToMulticlass |
Views this instance as a multi-class generative classifier,
giving access to more advanced methods, such as the prediction
of integer labels.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
ToMultilabel |
Views this instance as a multi-label generative classifier,
giving access to more advanced methods, such as the prediction
of one-hot vectors.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Transform(TInput) |
Applies the transformation to an input, producing an associated output.
(Inherited from ClassifierBaseTInput, TClasses.) | |
Transform(TInput) |
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
(Inherited from TransformBaseTInput, TOutput.) | |
Transform(TInput, Boolean) |
Applies the transformation to an input, producing an associated output.
(Inherited from BinaryClassifierBaseTInput.) | |
Transform(TInput, Int32) |
Applies the transformation to an input, producing an associated output.
(Inherited from BinaryClassifierBaseTInput.) | |
Transform(TInput, Boolean) |
Applies the transformation to an input, producing an associated output.
(Inherited from BinaryClassifierBaseTInput.) | |
Transform(TInput, Int32) |
Applies the transformation to an input, producing an associated output.
(Inherited from BinaryClassifierBaseTInput.) | |
Transform(TInput, Int32) |
Applies the transformation to an input, producing an associated output.
(Inherited from BinaryClassifierBaseTInput.) | |
Transform(TInput, Double) |
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Transform(TInput, Double) |
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Transform(TInput, Double) |
Applies the transformation to a set of input vectors,
producing an associated set of output vectors.
(Inherited from BinaryLikelihoodClassifierBaseTInput.) | |
Transform(TInput, TClasses) |
Applies the transformation to an input, producing an associated output.
(Inherited from ClassifierBaseTInput, TClasses.) |
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);