private void CreateTreeNode(FeatureTreeNode parentNode, FeatureSetType featureSet, TriStateTreeView treeView) { if (featureSet.Feature != null) { foreach (object o in featureSet.Feature) { FeatureTreeNode node = new FeatureTreeNode(); node.Text = ((FeatureType)o).name; switch (((FeatureType)o).configuration) { case ConfigType.Included: if (((FeatureType)o).kind == KindType.Mandatory) { //treeView.SetChecked(node, TriStateTreeView.CheckState.Checked); treeView.SetChecked(node, TriStateTreeView.CheckState.Greyed); } else { treeView.SetChecked(node, TriStateTreeView.CheckState.Checked); } break; case ConfigType.Excluded: treeView.SetChecked(node, TriStateTreeView.CheckState.Unchecked); break; case ConfigType.Unspecified: treeView.SetChecked(node, TriStateTreeView.CheckState.QuestionMark); break; } node.NodeFont = new System.Drawing.Font("Arial", 8, System.Drawing.FontStyle.Bold); parentNode.Nodes.Add(node); } } }
/// <summary> /// Gets the feature set. /// </summary> /// <param name="user">The user.</param> /// <param name="featureSetType">Type of the feature set.</param> /// <returns>The <see cref="FeatureSet"/></returns> public static FeatureSet GetFeatureSet(User user, FeatureSetType featureSetType) { var features = new List <IFeature>(); foreach (Type type in FeatureSets[featureSetType]) { if (!user.FeatureCache.ContainsKey(type)) { IFeature feature = (IFeature)Activator.CreateInstance(type); user.FeatureCache[type] = feature; feature.Configure(); var configurable = feature as IConfigurableFeature; if (configurable != null) { configurable.Configure(user); } } features.Add(user.FeatureCache[type]); } return(new FeatureSet { Name = featureSetType.ToString(), Features = features.ToList() }); }
public static FeatureSet Create(FeatureSetType featuresType) { switch (featuresType) { case FeatureSetType.DorsalFin: return(new FinFeatureSet()); case FeatureSetType.Bear: return(new BearFeatureSet()); default: throw new NotImplementedException(); } }
/// <summary> /// Gets the feature set without a user specified. This is used for the community feature set. /// </summary> /// <param name="featureSetType">Type of the feature set.</param> /// <returns>The <see cref="FeatureSet"/></returns> public static FeatureSet GetFeatureSet(FeatureSetType featureSetType) { var features = new List <IFeature>(); foreach (var type in FeatureSets[featureSetType]) { var feature = (IFeature)Activator.CreateInstance(type); feature.Configure(); } return(new FeatureSet { Name = featureSetType.ToString(), Features = features.ToList() }); }
/// <summary> /// Updates the error rates. /// </summary> /// <param name="featureSetType"> /// The feature Set Type. /// </param> internal void UpdateErrorRates(FeatureSetType featureSetType) { if (this.User == null) { return; } var trial = this.Trials[featureSetType]; var metrics = trial.ExperimentCollection.ValidationMetrics[0]; this.ErrorRates = string.Format( "Average Precision {0}, Area Under ROC Curve {1}, Calibration Error {2}", metrics.AveragePrecision.ToString("P1"), metrics.AreaUnderCurve.ToString("P1"), metrics.CalibrationError.ToString("N3")); }
public static FeatureSet Load(FeatureSetType featuresType, List <OutlineFeaturePoint> featurePoints, List <CoordinateFeaturePoint> coordinateFeaturePoints, List <Feature> features) { if (featurePoints == null) { throw new ArgumentNullException(nameof(featurePoints)); } switch (featuresType) { case FeatureSetType.DorsalFin: return(new FinFeatureSet(featurePoints, coordinateFeaturePoints, features)); case FeatureSetType.Bear: return(new BearFeatureSet(featurePoints, coordinateFeaturePoints, features)); default: throw new NotImplementedException(); } }
private void UnSelectChildNodesInObjectModelRecursive(FeatureSetType featureSet) { if (featureSet.Feature != null) { foreach (object subobj in featureSet.Feature) { if (subobj.GetType() == typeof(FeatureType)) { if (((FeatureType)subobj).kind != KindType.Mandatory) { ((FeatureType)subobj).configuration = ConfigType.Excluded; UnSelectChildNodesInObjectModelRecursive((FeatureType)subobj); } } else if (subobj.GetType() == typeof(FeatureSetType)) { UnSelectChildNodesInObjectModelRecursive((FeatureSetType)subobj); } } } }
/// <summary> /// Gets the community set. /// </summary> /// <param name="featureSetType">Type of the feature set.</param> /// <returns>The <see cref="FeatureSet" />.</returns> public static FeatureSet GetCommunitySet(FeatureSetType featureSetType) { var features = new List <IFeature>(); foreach (var type in FeatureSets[featureSetType]) { if (type.IsImplementationOf(typeof(IConfigurableFeature))) { continue; } var feature = (IFeature)Activator.CreateInstance(type); feature.Configure(); features.Add(feature); } return(new FeatureSet { Name = featureSetType.ToString(), Features = features.ToList() }); }
public static FeatureSet Create(FeatureSetType featuresType, Bitmap image, double scale, Chain chain, FloatContour chainPoints) { switch (featuresType) { case FeatureSetType.DorsalFin: if (chain == null || chainPoints == null) { return(new FinFeatureSet()); } return(new FinFeatureSet(chain, chainPoints)); case FeatureSetType.Bear: if (chain == null || chainPoints == null) { return(new BearFeatureSet()); } return(new BearFeatureSet(image, scale, chain, chainPoints)); default: throw new NotImplementedException(); } }
/// <summary> /// Gets the community set. /// </summary> /// <param name="communityFeatureSet">The community feature set.</param> /// <param name="user">The user.</param> /// <param name="featureSetType">Type of the feature set.</param> /// <returns> /// The <see cref="FeatureSet" />. /// </returns> public static FeatureSet GetPersonalSet(FeatureSet communityFeatureSet, User user, FeatureSetType featureSetType) { var personalFeatures = new List <IFeature>(); foreach (Type type in FeatureSets[featureSetType].Where(type => type.IsImplementationOf(typeof(IConfigurableFeature)))) { if (!user.FeatureCache.ContainsKey(type)) { var feature = (IFeature)Activator.CreateInstance(type); user.FeatureCache[type] = feature; feature.Configure(); var configurable = feature as IConfigurableFeature; if (configurable != null) { configurable.Configure(user); } } personalFeatures.Add(user.FeatureCache[type]); } return(new FeatureSet { Name = featureSetType.ToString(), Features = communityFeatureSet.Features.Concat(personalFeatures).ToList() }); }
/// <summary> /// Inputs from the user. /// </summary> /// <param name="user">The user.</param> /// <param name="featureSetType">Type of the feature set.</param> /// <returns> /// The <see cref="Inputs" /> /// </returns> public static Inputs FromUser(User user, FeatureSetType featureSetType) { return(FromUser(user, FeatureSet.GetFeatureSet(user, featureSetType))); }
// create TristateTreeView from XML file public void CreateTreeViewFromXmlFile(TriStateTreeView treeView) { FeatureModelConfiguration fmc = new FeatureModelConfiguration(this.fileName); rootFeature = fmc.GetFeatureModelConfigurationModel(); // Clear TriStateTreeView treeView.Nodes.Clear(); // treeView.BeginUpdate(); treeView.InitializeRootFeature(ref rootFeature); FeatureTreeNode rn = new FeatureTreeNode(); rn.Text = rootFeature.name; rn.InitializeRootFeature(ref rootFeature); //treeView.SetChecked(rn, TriStateTreeView.CheckState.Checked); treeView.SetChecked(rn, TriStateTreeView.CheckState.Greyed); treeView.Nodes.Add(rn); foreach (object o in rootFeature.Items) { if (o.GetType() == typeof(FeatureType)) { FeatureType ft = (FeatureType)o; FeatureTreeNode subRootNode = new FeatureTreeNode(); subRootNode.Text = ft.name; subRootNode.InitializeFeature(ref ft); if (ft.kind == KindType.Optional || ft.kind == KindType.FeatureSetFeature) { subRootNode.NodeFont = new System.Drawing.Font("Arial", 8, System.Drawing.FontStyle.Bold); } switch (ft.configuration) { case ConfigType.Included: if (ft.kind == KindType.Mandatory) { //treeView.SetChecked(subRootNode, TriStateTreeView.CheckState.Checked); treeView.SetChecked(subRootNode, TriStateTreeView.CheckState.Greyed); } else { treeView.SetChecked(subRootNode, TriStateTreeView.CheckState.Checked); } break; case ConfigType.Excluded: treeView.SetChecked(subRootNode, TriStateTreeView.CheckState.Unchecked); break; case ConfigType.Unspecified: treeView.SetChecked(subRootNode, TriStateTreeView.CheckState.QuestionMark); break; } rn.Nodes.Add(subRootNode); CreateTreeNode(subRootNode, ft, treeView); } else if (o.GetType() == typeof(FeatureSetType)) { FeatureSetType fst = (FeatureSetType)o; FeatureTreeNode subRootNode = new FeatureTreeNode(); subRootNode.Text = string.Format("FeatureSet [{0}...{1}]", fst.min, fst.max); treeView.SetChecked(subRootNode, TriStateTreeView.CheckState.FeatureSet); rn.Nodes.Add(subRootNode); CreateTreeNode(subRootNode, fst, treeView); } } treeView.ExpandAll(); treeView.EndUpdate(); }
private void CheckFeatureSetChildren(FeatureSetType featureSet, ref ArrayList array) { int number = 0; if (!(featureSet.max.Equals("n")) || !(featureSet.max.Equals("N"))) { int min = Int32.Parse(featureSet.min); int max = Int32.Parse(featureSet.max); foreach (object o in featureSet.Feature) { if (((FeatureType)o).configuration == ConfigType.Included) { number++; } } if (number > max) { // Number fuer Max ausserhalb des Bereichs string children = ""; foreach (object o in featureSet.Feature) { if (!children.Equals("")) { children = string.Concat(children, " | ", ((FeatureType)o).name); } else { children = ((FeatureType)o).name; } } array.Add(string.Format("WRONG CONFIGURATION: FeatureSet [{0}...{1}]({2}) - too many features selected", featureSet.min, featureSet.max, children)); } else if (number < min) { // Number fuer Min ausserhalb des Bereichs string children = ""; foreach (object o in featureSet.Feature) { if (!children.Equals("")) { children = string.Concat(children, " | ", ((FeatureType)o).name); } else { children = ((FeatureType)o).name; } } array.Add(string.Format("WRONG CONFIGURATION: FeatureSet [{0}...{1}]({2}) - too little features selected", featureSet.min, featureSet.max, children)); } else { return; // Ok } } else { int min = Int32.Parse(featureSet.min); foreach (object o in featureSet.Feature) { if (((FeatureType)o).configuration == ConfigType.Included) { number++; } } if (number < min) { // Number fuer Min ausserhalb des Bereichs array.Add(string.Format("WRONG CONFIGURATION: FeatureSet [{0}...{1}] - too little features selected", featureSet.min, featureSet.max)); } else { return; // Ok } } }