public IModelDiscreteIterative <int, int> GenerateModelDiscreteIncremental(IDataSet <int, int> training_set) { //TODO check data context ModelNearestNeighborList <int, int, int> model = new ModelNearestNeighborList <int, int, int>(training_set.DataContext, new FunctionDistanceHamming()); IList <Tuple <int[], int> > training_instances = new List <Tuple <int[], int> >(); for (int instance_index = 0; instance_index < training_set.InstanceCount; instance_index++) { training_instances.Add(new Tuple <int[], int>(training_set.GetInstanceFeatureData(instance_index), training_set.GetInstanceLabelData(instance_index)[0])); } model.Add(training_instances); return(model); }
public IModelDiscreteIterative <DomainType, LabelType> GenerateModelDiscrete(IDataSet <DomainType, LabelType> training_set) { ModelNearestNeighborList <DomainType, DistanceType, LabelType> model = new ModelNearestNeighborList <DomainType, DistanceType, LabelType>( this.DataContext, new List <Tuple <DomainType[], LabelType> >(this.list), this.distance_function, this.voting_system, this.neighbor_count); IList <Tuple <DomainType[], LabelType> > training_instances = new List <Tuple <DomainType[], LabelType> >(); for (int instance_index = 0; instance_index < training_set.InstanceCount; instance_index++) { training_instances.Add(new Tuple <DomainType[], LabelType>(training_set.GetInstanceFeatureData(instance_index), training_set.GetInstanceLabelData(instance_index)[0])); } model.Add(training_instances); return(model); }