Class AbstractModel
public abstract class AbstractModel : IMaxentModel
- Inheritance
-
AbstractModel
- Implements
- Derived
- Inherited Members
Constructors
AbstractModel(Context[], string[], IDictionary<string, Context>, string[])
protected AbstractModel(Context[] @params, string[] predLabels, IDictionary<string, Context> pmap, string[] outcomeNames)
Parameters
AbstractModel(Context[], string[], string[])
protected AbstractModel(Context[] @params, string[] predLabels, string[] outcomeNames)
Parameters
Fields
evalParams
Parameters for the model.
protected EvalParameters evalParams
Field Value
modelType
The type of the model.
protected AbstractModel.ModelType modelType
Field Value
outcomeNames
The names of the outcomes.
protected string[] outcomeNames
Field Value
- string[]
pmap
Mapping between predicates/contexts and an integer representing them.
protected IDictionary<string, Context> pmap
Field Value
Remarks
Backed by J2N.Collections.Generic.OrderedDictionary<TKey, TValue> so iteration order
is insertion order, matching the LinkedHashMap upstream adopted in
OPENNLP-1321. Declared as IDictionary<TKey, TValue> to keep the
J2N type out of the exposed signature.
prior
Prior distribution for this model.
protected IPrior? prior
Field Value
Properties
NumOutcomes
Returns the number of outcomes for this model.
public virtual int NumOutcomes { get; }
Property Value
- int
The number of outcomes.
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
Eval(string[])
Evaluates a context.
public abstract double[] Eval(string[] context)
Parameters
contextstring[]A list of String names of the contextual predicates which are to be evaluated together.
Returns
- double[]
an array of the probabilities for each of the different outcomes, all of which sum to 1.
Eval(string[], double[])
Evaluates a context.
public abstract double[] Eval(string[] context, double[] probs)
Parameters
contextstring[]A list of String names of the contextual predicates which are to be evaluated together.
probsdouble[]An array which is populated with the probabilities for each of the different outcomes, all of which sum to 1.
Returns
- double[]
an array of the probabilities for each of the different outcomes, all of which sum to 1.
Eval(string[], float[])
Evaluates a contexts with the specified context values.
public abstract double[] Eval(string[] context, float[] values)
Parameters
contextstring[]A list of String names of the contextual predicates which are to be evaluated together.
valuesfloat[]The values associated with each context.
Returns
- double[]
an array of the probabilities for each of the different outcomes, all of which sum to 1.
GetAllOutcomes(double[])
Return a string matching all the outcome names with all the probabilities produced by the Eval(string[]) method.
public string GetAllOutcomes(double[] ocs)
Parameters
ocsdouble[]A double array as returned by the Eval(string[]) method.
Returns
- string
String containing outcome names paired with the normalized probability (contained in the
ocs) for each one.
GetBestOutcome(double[])
Return the name of the outcome corresponding to the highest likelihood in the parameter ocs.
public string GetBestOutcome(double[] ocs)
Parameters
ocsdouble[]A double array as returned by the Eval(string[]) method.
Returns
- string
The name of the most likely outcome.
GetDataStructures()
Provides the fundamental data structures which encode the maxent model information. This method will usually only be needed by GISModelWriters. The following values are held in the Object array which is returned by this method:
public object[] GetDataStructures()
Returns
- object[]
An Object[] with the values as described above.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetIndex(string)
Gets the index associated with the string name of the given outcome.
public virtual int GetIndex(string outcome)
Parameters
outcomestringthe string name of the outcome for which the index is desired
Returns
- int
the index if the given outcome label exists for this model, -1 if it does not.
GetModelType()
public virtual AbstractModel.ModelType GetModelType()
Returns
GetOutcome(int)
Return the name of an outcome corresponding to an int id.
public string GetOutcome(int i)
Parameters
iintAn outcome id.
Returns
- string
The name of the outcome associated with that id.