/// <summary> /// Returns the statistics for each feature /// </summary> /// <returns></returns> public IEnumerable <FeatureStatistics> Statistics() { if (!this.HasMols) { return(new List <FeatureStatistics>()); } return(MolDescriptor.GetFeatureNames().Select(f => new FeatureStatistics(this.FeatureValues(f)))); }
/// <summary> /// Returns the names of all the available features /// </summary> public static string[] GetFeatureNames() { var descriptor = new MolDescriptor(new OBMol()); return(descriptor.Features .Select(p => p.GetCustomAttributes(false).OfType <FeatureAttribute>().First().Name) .Concat(descriptor.FragmentCounts.Keys).OrderBy(n => n) .ToArray()); }
/// <summary> /// Converts the molecular description collection to a Matrix object /// </summary> /// <returns></returns> public Matrix ToMatrix() { if (!this.HasMols) { return(new Matrix(0, 0)); } var features = MolDescriptor.GetFeatureNames().OrderBy(n => n); var matrix = new Matrix(this.NumMols, features.Count()); var i = 0; foreach (var descriptor in this.MolDescriptors) { var j = 0; foreach (var feature in features) { matrix.Update(i, j, descriptor.FeatureValue(feature).Value); j++; } i++; } return(matrix); }
/// <summary> /// Returns an array of feature value objects holding values for all features. /// </summary> /// <returns></returns> public double[] ToArray() { return(MolDescriptor.GetFeatureNames().Select(n => this.FeatureValue(n).Value).ToArray()); }
/// <summary> /// Number of features in a MolDescriptor instance /// </summary> public static int FeatureCount() { return(MolDescriptor.GetFeatureNames().Length); }