/// <summary> /// Constructs a Multinomial Logistic Regression Analysis. /// </summary> /// /// <param name="inputs">The input data for the analysis.</param> /// <param name="outputs">The output data for the analysis.</param> /// public MultinomialLogisticRegressionAnalysis(double[][] inputs, int[] outputs) { // Initial argument checking if (inputs == null) { throw new ArgumentNullException("inputs"); } if (outputs == null) { throw new ArgumentNullException("outputs"); } if (inputs.Length != outputs.Length) { throw new ArgumentException("The number of rows in the input array must match the number of given outputs."); } init(inputs, Categorical.OneHot(outputs)); }
/// <summary> /// Gets the Deviance for the model. /// </summary> /// /// <remarks> /// The deviance is defined as -2*Log-Likelihood. /// </remarks> /// /// <param name="inputs">A set of input data.</param> /// <param name="classes">A set of output data.</param> /// <returns> /// The deviance (a measure of performance) of the model /// calculated over the given data sets. /// </returns> /// public double GetLogLikelihood(double[][] inputs, int[] classes) { return(GetLogLikelihood(inputs, Categorical.OneHot(classes))); }
/// <summary> /// The likelihood ratio test of the overall model, also called the model chi-square test. /// </summary> /// /// <remarks> /// <para> /// The Chi-square test, also called the likelihood ratio test or the log-likelihood test /// is based on the deviance of the model (-2*log-likelihood). The log-likelihood ratio test /// indicates whether there is evidence of the need to move from a simpler model to a more /// complicated one (where the simpler model is nested within the complicated one).</para> /// <para> /// The difference between the log-likelihood ratios for the researcher's model and a /// simpler model is often called the "model chi-square".</para> /// </remarks> /// public ChiSquareTest ChiSquare(double[][] input, int[] classes) { return(ChiSquare(input, Categorical.OneHot(classes))); }
/// <summary> /// Runs one iteration of the Lower-Bound Newton-Raphson iteration. /// </summary> /// <param name="inputs">The input data.</param> /// <param name="classes">The outputs associated with each input vector.</param> /// <returns>The maximum relative change in the parameters after the iteration.</returns> /// public double Run(double[][] inputs, int[] classes) { return(run(inputs, Categorical.OneHot(classes))); }