//what about Id??? public void Append(FeatureItem item) { item.Id = FeatureItemList.Count; //update Id according to FeatureItemList numeration FeatureItemList.Add(item); AssignCluster(item); //Get items assigned to hyperClusters for (int i = 0; i < HyperClusterList.Count; i++) { HyperClusterList[i].GetHyperClusterItemList(); } }
public void LoadFile(string fileLocation) { string line; FeatureNameList.Clear(); FeatureNameList.Add("Name"); StreamReader file = new StreamReader(fileLocation); while ((line = file.ReadLine()) != null) { if (line == "ItemList") { break; } } if (line == null) { throw new Exception("ART File does not have a section marked ItemList!"); } else { while ((line = file.ReadLine()) != null) { if (line == "--") { break; } else { FeatureNameList.Add(line); } } FeatureItemSize = FeatureNameList.Count - 1; //Finished reading itemList, now read all the people int featureItemId = 0; while ((line = file.ReadLine()) != null) { string featureName = line; line = file.ReadLine(); double[] featureVector = new double[FeatureItemSize]; int i = 0; while ((line != null) && (line != "--")) { featureVector[i] = Int32.Parse(line); /// 10.00; //here read the values, but normalize in other part. ++i; line = file.ReadLine(); } if (line == "--") { if (i != FeatureItemSize) { //For those who don't have a fully specified prefList, fill with 0s for rest. for (int j = i; j < FeatureItemSize; ++j) { featureVector[j] = 0; } } FeatureItemList.Add(new FeatureItem(featureItemId, featureName, featureVector)); featureItemId++; } } } file.Close(); }