internal InputLayerDrawing(InputLayer layer, IPreference preferences, LayerSizesPreCalc cache, SimpleNodeSizesPreCalc simpleNodeSizesCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(layer, preferences, cache, simpleNodeSizesCache, selectionChecker, selectableElementRegister) { _preference = preferences; _simpleNodeSizesCache = simpleNodeSizesCache; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; }
void Start() { // preference IPreference <Vector3> pref = PreferenceFactory.CreateJsonPref <Vector3>( key: "vector3-test" ); // set value pref.Value = Vector3.up; // Value: (0.0, 1.0, 0.0) Debug.Log("Value: " + pref.Value); // delete pref.DeleteValue(); // GetValueOrDefault: (0.0, -1.0, 0.0) Debug.Log("GetValueOrDefault: " + pref.GetValueOrDefault(Vector3.down)); // AES encoding preference IPreference <Vector3> cryptoPref = PreferenceFactory.CreateJsonCryptoPref <Vector3>( key: "vector3-crypto-test", password: "******", salt: "salt1234567890" ); cryptoPref.Value = Vector3.up; // return true Debug.Log("CryptoHasValue: " + cryptoPref.HasValue); // key and value are encrypted // return false Debug.Log("PlayerPrefs.HasValue: " + PlayerPrefs.HasKey("vector3-crypto-test")); }
/// <summary> /// Builds a preference entry for the provided parent based on the provided XElement node /// </summary> /// <param name="parent">The parent.</param> /// <param name="foundEntry">The found entry.</param> /// <returns></returns> private IPreferenceEntry BuildPreferenceEntry(IPreference parent, XElement foundEntry) { var name = XElementHelper.ReadStringValue(foundEntry, "name"); var friendlyName = XElementHelper.ReadStringValue(foundEntry, "friendlyName"); var description = XElementHelper.ReadStringValue(foundEntry, "description", false); var isSelectedByDefault = XElementHelper.ReadBoolValue(foundEntry, "isDefault", false); if (isSelectedByDefault && parent.HasDirectlyEditableValue) { /* * This preference has both a list of pre-defined entries - one of which are selected by default - * and a default value specified in the config file. There is really no obvious way to know which * the user actually wanted to be the default value, so log this as a warning, and let the * pre-defined option override the directly specified default value. */ parent.Value = name; } var entry = new PreferenceEntry(name, friendlyName, description, parent) { IsSelected = isSelectedByDefault }; return(entry); }
public static void SavePreference(StringBuilder sb, ref int tabLevel, string key, object obj) { if (obj == null) { WriteTag(sb, tabLevel, key, "null", null); } else if (obj is int) { WriteTag(sb, tabLevel, key, "int", obj); } else if (obj is string) { WriteTag(sb, tabLevel, key, "string", obj); } else if (obj is bool) { bool v = (bool)obj; WriteTag(sb, tabLevel, key, "bool", v ? "True" : "False"); } else if (obj is TimeSpan) { WriteTag(sb, tabLevel, key, "TimeSpan", obj); } else if (obj is IPreference) { IPreference v = (IPreference)obj; v.WriteTag(sb, ref tabLevel, key); } }
/// TODO: this is the vanilla sgd by Tacaks 2009, I speculate that using scaling technique proposed in: /// Towards Optimal One Pass Large Scale Learning with Averaged Stochastic Gradient Descent section 5, page 6 /// can be beneficial in term s of both speed and accuracy. /// /// Tacaks' method doesn't calculate gradient of regularization correctly, which has non-zero elements everywhere of /// the matrix. While Tacaks' method can only updates a single row/column, if one user has a lot of recommendation, /// her vector will be more affected by regularization using an isolated scaling factor for both user vectors and /// item vectors can remove this issue without inducing more update cost it even reduces it a bit by only performing /// one addition and one multiplication. /// /// BAD SIDE1: the scaling factor decreases fast, it has to be scaled up from time to time before dropped to zero or /// caused roundoff error /// BAD SIDE2: no body experiment on it before, and people generally use very small lambda /// so it's impact on accuracy may still be unknown. /// BAD SIDE3: don't know how to make it work for L1-regularization or /// "pseudorank?" (sum of singular values)-regularization protected void update(IPreference preference, double mu) { int userIdx = userIndex(preference.GetUserID()); int itemIdx = itemIndex(preference.GetItemID()); double[] userVector = userVectors[userIdx]; double[] itemVector = itemVectors[itemIdx]; double prediction = dot(userVector, itemVector); double err = preference.GetValue() - prediction; // adjust features for (int k = FEATURE_OFFSET; k < rank; k++) { double userFeature = userVector[k]; double itemFeature = itemVector[k]; userVector[k] += mu * (err * itemFeature - lambda * userFeature); itemVector[k] += mu * (err * userFeature - lambda * itemFeature); } // adjust user and item bias userVector[USER_BIAS_INDEX] += biasMuRatio * mu * (err - biasLambdaRatio * lambda * userVector[USER_BIAS_INDEX]); itemVector[ITEM_BIAS_INDEX] += biasMuRatio * mu * (err - biasLambdaRatio * lambda * itemVector[ITEM_BIAS_INDEX]); }
/// <summary> /// When overridden in a derived class, returns a <see cref="T:System.Windows.DataTemplate" /> based on custom logic. /// </summary> /// <param name="item">The data object for which to select the template.</param> /// <param name="container">The data-bound object.</param> /// <returns> /// Returns a <see cref="T:System.Windows.DataTemplate" /> or null. The default value is null. /// </returns> /// <exception cref="System.NotImplementedException">PreferenceTemplateSelector support missing for this type of preference</exception> public override DataTemplate SelectTemplate(object item, DependencyObject container) { FrameworkElement element = container as FrameworkElement; IPreference preference = item as IPreference; if (element == null || preference == null) { return(null); } if (preference.HasPreDefinedChoices && preference.HasDirectlyEditableValue) { //Predefined choices, directly editable values return(element.FindResource("PredefinedValuesWithDirectOverrideTemplate") as DataTemplate); } else if (preference.HasPreDefinedChoices && !preference.HasDirectlyEditableValue) { // Only predefined choices - regardless of whether they're numeric or not. return(element.FindResource("PredefinedItemsPreferenceTemplate") as DataTemplate); } else if (!preference.HasPreDefinedChoices && preference.HasDirectlyEditableValue && preference.IsNumeric) { // Numeric value the user can edit. return(element.FindResource("NumericPreferenceTemplate") as DataTemplate); } else if (!preference.HasPreDefinedChoices && preference.HasDirectlyEditableValue && !preference.IsNumeric) { // Plain string that the user can edit return(element.FindResource("PlainStringPreferenceTemplate") as DataTemplate); } else { throw new NotImplementedException("PreferenceTemplateSelector support missing for this type of preference"); } }
//merge this part into shuffle() will make compiler-optimizer do some real absurd stuff, test on OpenJDK7 private void swapCachedPreferences(int x, int y) { IPreference p = unstagedPreferences[x]; unstagedPreferences[x] = unstagedPreferences[y]; unstagedPreferences[y] = p; }
/// <summary> /// Initializes a new instance of the <see cref="PreferenceEntry"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="friendlyName">Name of the friendly.</param> /// <param name="description">The description.</param> /// <param name="parent">The parent.</param> public PreferenceEntry(string name, string friendlyName, string description, IPreference parent) { this.Name = name; this.Description = description; this.FriendlyName = friendlyName; this.Parent = parent; }
public void Add(IPreference preference) { if (this.preferenceDictionary.ContainsKey(preference.Name)) { Log.Warning("Preference already added to EdB.Interface.Preferences: " + preference.Name); return; } string group = preference.Group; PreferenceGroup preferenceGroup; if (group == null) { preferenceGroup = this.miscellaneousGroup[0]; } else if (this.groupDictionary.ContainsKey(group)) { preferenceGroup = this.groupDictionary[group]; } else { preferenceGroup = new PreferenceGroup(group); this.groups.Add(preferenceGroup); this.groupDictionary.Add(group, preferenceGroup); } preferenceGroup.Add(preference); this.preferenceDictionary.Add(preference.Name, preference); this.atLeastOne = true; }
/// <summary> /// Builds a preference entry for the provided parent based on the provided XElement node /// </summary> /// <param name="parent">The parent.</param> /// <param name="foundEntry">The found entry.</param> /// <returns></returns> private TPreferenceEntry BuildPreferenceEntry <TPreferenceEntry>(IPreference parent, XElement foundEntry) where TPreferenceEntry : class, IPreferenceEntry { // Rather ugly way of reading shared properties + returning the newly created entry // Several unplesant compromises here Func <IPreferenceEntry, TPreferenceEntry> readSharedProperties = entry => { entry.FriendlyName = XElementHelper.ReadStringValue(foundEntry, "friendlyName"); entry.Description = XElementHelper.ReadStringValue(foundEntry, "description", false); entry.IsSelected = XElementHelper.ReadBoolValue(foundEntry, "isDefault", false); //if (isSelectedByDefault && parent.HasDirectlyEditableValue) //{ // /* // * This preference has both a list of pre-defined entries - one of which are selected by default - // * and a default value specified in the config file. There is really no obvious way to know which // * the user actually wanted to be the default value, so log this as a warning, and let the // * pre-defined option override the directly specified default value. // */ // parent.Value = name; //} return(entry as TPreferenceEntry); }; if (parent is INumericPreference) { var entry = new NumericPreferenceEntry { Parent = (INumericPreference)parent, Name = XElementHelper.ReadDoubleValue(foundEntry, "name") }; return(readSharedProperties(entry)); } if (parent is IDatePreference) { var dateFormat = ((IDatePreference)parent).DateFormat; var entry = new DatePreferenceEntry { Parent = (IDatePreference)parent, Name = XElementHelper.ReadDateValue(foundEntry, "name", dateFormat) }; return(readSharedProperties(entry)); } if (parent is IStringPreference) { var entry = new StringPreferenceEntry { Parent = (IStringPreference)parent, Name = XElementHelper.ReadStringValue(foundEntry, "name") }; return(readSharedProperties(entry)); } throw new NotSupportedException("Invalid parent object"); }
public void Add(string customer, IPreference preference) { if (!customerPreferences.TryAdd(customer, preference)) { throw new InvalidOperationException($"A preference for {customer} already exists"); } }
public virtual IPreference GetPreference(string key, IPreference defaultValue) { if (this.ContainsKey(key) && (this[key] is IPreference)) { return((IPreference)this[key]); } return(defaultValue); }
/// <summary> /// Builds a preference entry for the provided parent based on the provided XElement node /// </summary> /// <param name="parent">The parent.</param> /// <param name="foundEntry">The found entry.</param> /// <returns></returns> private TPreferenceEntry BuildPreferenceEntry <TPreferenceEntry>(IPreference parent, XElement foundEntry) where TPreferenceEntry : class, IPreferenceEntry { // Rather ugly way of reading shared properties + returning the newly created entry // Several unplesant compromises here Func <IPreferenceEntry, TPreferenceEntry> readSharedProperties = entry => { entry.FriendlyName = XElementHelper.ReadStringValue(foundEntry, "friendlyName"); entry.Description = XElementHelper.ReadStringValue(foundEntry, "description", false); entry.IsSelected = XElementHelper.ReadBoolValue(foundEntry, "isDefault", false); return(entry as TPreferenceEntry); }; if (parent is INumericPreference) { var entry = new NumericPreferenceEntry { Parent = (INumericPreference)parent, Name = XElementHelper.ReadDoubleValue(foundEntry, "name") }; return(readSharedProperties(entry)); } if (parent is IDatePreference) { var dateFormat = ((IDatePreference)parent).DateFormat; var entry = new DatePreferenceEntry { Parent = (IDatePreference)parent, Name = XElementHelper.ReadDateValue(foundEntry, "name", dateFormat) }; return(readSharedProperties(entry)); } if (parent is IStringListPreference) { var entry = new StringListPreferenceEntry { Parent = (IStringListPreference)parent, Name = XElementHelper.ReadStringValue(foundEntry, "name") }; return(readSharedProperties(entry)); } if (parent is IStringPreference) { var entry = new StringPreferenceEntry { Parent = (IStringPreference)parent, Name = XElementHelper.ReadStringValue(foundEntry, "name") }; return(readSharedProperties(entry)); } throw new NotSupportedException("Invalid parent object"); }
internal LayerBaseDrawing(TLayer layer, IPreference preferences, LayerSizesPreCalc cache, SimpleNodeSizesPreCalc biasCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(layer) { _preferences = preferences; _cache = cache; _biasCache = biasCache; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; _nodesDrawing = new List <INodeDrawing>(layer.GetAllNodes().Count()); }
public static PreferenceInfo ToPreferenceInfo([NotNull] this IPreference preference) { if (preference == null) { throw new ArgumentNullException(nameof(preference)); } return(new PreferenceInfo(preference.Name, preference.ShortName, preference.Description, preference.ArgumentHelpText)); }
internal NeuronLayerDrawing(NeuronLayer layer, IDictionary <NodeBase, INodeDrawing> previousNodes, ICanvas edgesCanvas, IPreference preferences, LayerSizesPreCalc cache, NeuronSizesPreCalc neuronCache, SimpleNodeSizesPreCalc biasCache, EdgeSizesPreCalc edgesCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(layer, preferences, cache, biasCache, selectionChecker, selectableElementRegister) { _previousNodes = previousNodes; _edgesCanvas = edgesCanvas; _preferences = preferences; _neuronCache = neuronCache; _edgesCache = edgesCache; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; }
internal NeuronDrawing(Neuron element, IDictionary <NodeBase, INodeDrawing> previousNodes, ICanvas edgesCanvas, IPreference preferences, NeuronSizesPreCalc cache, EdgeSizesPreCalc edgesCache, IElementSelectionChecker selectionChecker, ISelectableElementRegister selectableElementRegister) : base(element, preferences.Neurons, cache, selectableElementRegister, selectionChecker) { _previousNodes = previousNodes; _edgesCanvas = edgesCanvas; _preferences = preferences; _cache = cache; _edgesCache = edgesCache; _selectionChecker = selectionChecker; _selectableElementRegister = selectableElementRegister; }
private void SetMasterPreferenceOn(ICollection <IPreference> customerPreferences) { var hasMasterPreference = bool.TryParse(_lineElements[3], out var masterPreferenceChoice); if (!hasMasterPreference) { return; } IPreference masterPreference = masterPreferenceChoice ? new EveryDayPreference() : new DontContactPreference(); customerPreferences.Add(masterPreference); }
public BooleanItemPreferenceArray(List <IPreference> prefs, bool forOneUser) : this(prefs.Count) { int size = prefs.Count; for (int i = 0; i < size; i++) { IPreference pref = prefs[i]; ids[i] = forOneUser ? pref.GetItemID() : pref.GetUserID(); } if (size > 0) { id = forOneUser ? prefs[0].GetUserID() : prefs[0].GetItemID(); } }
public BooleanUserPreferenceArray(List <IPreference> prefs) : this(prefs.Count) { int size = prefs.Count; for (int i = 0; i < size; i++) { IPreference pref = prefs[i]; ids[i] = pref.GetItemID(); } if (size > 0) { id = prefs[0].GetUserID(); } }
private void AddNewCustomerPreference() { _("-- Add Customer preference --"); try { string customer = GetCustomer(); IPreference preference = GetPreference(); customerPreferenceStore.Add(customer, preference); _($"*** Created new customer Preference : [{customer}] => [{preference}]"); } catch (OperationCanceledException) { _("-- CANCELLED: Add customer preference --"); } }
public void testPreferencesForItem() { IPreferenceArray prefs = model.GetPreferencesForItem(456); Assert.NotNull(prefs); IPreference pref1 = prefs.Get(0); Assert.AreEqual(123, pref1.GetUserID()); Assert.AreEqual(456, pref1.GetItemID()); IPreference pref2 = prefs.Get(1); Assert.AreEqual(456, pref2.GetUserID()); Assert.AreEqual(456, pref2.GetItemID()); Assert.AreEqual(2, prefs.Length()); }
public async Task Prefs(string prefName = null, string value = null) { if (!await PlayerHandler.AttemptLogin(Context.User)) { await ReplyAsync(Context.User.Mention + ": " + Modules.NOT_REGISTERED_MSG); return; } Player p = PlayerHandler.GetPlayer(Context.User); if (String.IsNullOrWhiteSpace(value) && String.IsNullOrWhiteSpace(prefName)) { StringBuilder outp = new StringBuilder(Modules.PREF_MSG_START); foreach (string key in p.GetPreferences().Keys) { IPreference pref = p.GetPreferences()[key]; outp.Append(key + ": " + pref + "\n"); } await ReplyAsync(outp.ToString()); return; } else if (!String.IsNullOrWhiteSpace(prefName) && String.IsNullOrWhiteSpace(value)) { IPreference pref = p.GetPreferences()[prefName]; if (pref == null) { await ReplyAsync(Context.User.Mention + ": That preference does not exist"); return; } await ReplyAsync(Context.User.Mention + ": " + prefName + " is " + pref); return; } else if (!String.IsNullOrWhiteSpace(prefName) && !String.IsNullOrWhiteSpace(value)) { IPreference pref = p.GetPreferences()[prefName]; Type t = pref.type; var toSet = Convert.ChangeType(value, t); p.SetPreferenceWithType(prefName, toSet, t); } }
public void testPreferenceShufflerWithSyntheticData() { setUpSyntheticData(); ParallelSGDFactorizer.PreferenceShuffler shuffler = new ParallelSGDFactorizer.PreferenceShuffler(dataModel); shuffler.shuffle(); shuffler.stage(); FastByIDMap <FastByIDMap <bool?> > checkedLst = new FastByIDMap <FastByIDMap <bool?> >(); for (int i = 0; i < shuffler.size(); i++) { IPreference pref = shuffler.get(i); float?value = dataModel.GetPreferenceValue(pref.GetUserID(), pref.GetItemID()); Assert.AreEqual(pref.GetValue(), value.Value, 0.0); if (!checkedLst.ContainsKey(pref.GetUserID())) { checkedLst.Put(pref.GetUserID(), new FastByIDMap <bool?>()); } Assert.IsNull(checkedLst.Get(pref.GetUserID()).Get(pref.GetItemID())); checkedLst.Get(pref.GetUserID()).Put(pref.GetItemID(), true); } var userIDs = dataModel.GetUserIDs(); int index = 0; while (userIDs.MoveNext()) { long userID = userIDs.Current; IPreferenceArray preferencesFromUser = dataModel.GetPreferencesFromUser(userID); foreach (IPreference preference in preferencesFromUser) { Assert.True(checkedLst.Get(preference.GetUserID()).Get(preference.GetItemID()).Value); index++; } } Assert.AreEqual(index, shuffler.size()); }
public GenericItemPreferenceArray(IList <IPreference> prefs) : this(prefs.Count) { int size = prefs.Count; long itemID = Int64.MinValue; for (int i = 0; i < size; i++) { IPreference pref = prefs[i]; ids[i] = pref.GetUserID(); if (i == 0) { itemID = pref.GetItemID(); } else { if (itemID != pref.GetItemID()) { throw new ArgumentException("Not all item IDs are the same"); } } values[i] = pref.GetValue(); } id = itemID; }
/// <summary> /// Builds a preference entry for the provided parent based on the provided XElement node /// </summary> /// <param name="parent">The parent.</param> /// <param name="foundEntry">The found entry.</param> /// <returns></returns> private IPreferenceEntry BuildPreferenceEntry(IPreference parent, XElement foundEntry) { var name = XElementHelper.ReadStringValue(foundEntry, "name"); var friendlyName = XElementHelper.ReadStringValue(foundEntry, "friendlyName"); var description = XElementHelper.ReadStringValue(foundEntry, "description", false); var isSelectedByDefault = XElementHelper.ReadBoolValue(foundEntry, "isDefault", false); if (isSelectedByDefault && parent.HasDirectlyEditableValue) { /* * This preference has both a list of pre-defined entries - one of which are selected by default - * and a default value specified in the config file. There is really no obvious way to know which * the user actually wanted to be the default value, so log this as a warning, and let the * pre-defined option override the directly specified default value. */ parent.Value = name; } var entry = new PreferenceEntry(name, friendlyName, description, parent) { IsSelected = isSelectedByDefault }; return entry; }
public NeuronSizesPreCalc(IPreference preferences) { _preferences = preferences; }
/// TODO: this is the vanilla sgd by Tacaks 2009, I speculate that using scaling technique proposed in: /// Towards Optimal One Pass Large Scale Learning with Averaged Stochastic Gradient Descent section 5, page 6 /// can be beneficial in term s of both speed and accuracy. /// /// Tacaks' method doesn't calculate gradient of regularization correctly, which has non-zero elements everywhere of /// the matrix. While Tacaks' method can only updates a single row/column, if one user has a lot of recommendation, /// her vector will be more affected by regularization using an isolated scaling factor for both user vectors and /// item vectors can remove this issue without inducing more update cost it even reduces it a bit by only performing /// one addition and one multiplication. /// /// BAD SIDE1: the scaling factor decreases fast, it has to be scaled up from time to time before dropped to zero or /// caused roundoff error /// BAD SIDE2: no body experiment on it before, and people generally use very small lambda /// so it's impact on accuracy may still be unknown. /// BAD SIDE3: don't know how to make it work for L1-regularization or /// "pseudorank?" (sum of singular values)-regularization protected void update(IPreference preference, double mu) { int userIdx = userIndex(preference.GetUserID()); int itemIdx = itemIndex(preference.GetItemID()); double[] userVector = userVectors[userIdx]; double[] itemVector = itemVectors[itemIdx]; double prediction = dot(userVector, itemVector); double err = preference.GetValue() - prediction; // adjust features for (int k = FEATURE_OFFSET; k < rank; k++) { double userFeature = userVector[k]; double itemFeature = itemVector[k]; userVector[k] += mu * (err * itemFeature - lambda * userFeature); itemVector[k] += mu * (err * userFeature - lambda * itemFeature); } // adjust user and item bias userVector[USER_BIAS_INDEX] += biasMuRatio * mu * (err - biasLambdaRatio * lambda * userVector[USER_BIAS_INDEX]); itemVector[ITEM_BIAS_INDEX] += biasMuRatio * mu * (err - biasLambdaRatio * lambda * itemVector[ITEM_BIAS_INDEX]); }
protected abstract void processOneEstimate(float estimatedPreference, IPreference realPref);
protected override void processOneEstimate(float estimatedPreference, IPreference realPref) { double diff = realPref.GetValue() - estimatedPreference; average.AddDatum(diff * diff); }
public void Set(int i, IPreference pref) { id = pref.GetItemID(); ids[i] = pref.GetUserID(); values[i] = pref.GetValue(); }
public void Load() { try { XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.LoadXml(File.ReadAllText(this.FilePath)); } catch (FileNotFoundException) { return; } IEnumerator enumerator = xmlDocument.ChildNodes.GetEnumerator(); try { while (enumerator.MoveNext()) { object current = enumerator.Current; if (current is XmlElement) { XmlElement xmlElement = current as XmlElement; if ("Preferences".Equals(xmlElement.Name)) { IEnumerator enumerator2 = xmlElement.ChildNodes.GetEnumerator(); try { while (enumerator2.MoveNext()) { object current2 = enumerator2.Current; if (current2 is XmlElement) { XmlElement xmlElement2 = current2 as XmlElement; string name = xmlElement2.Name; if (this.preferenceDictionary.ContainsKey(name)) { IPreference preference = this.preferenceDictionary[name]; preference.ValueForSerialization = xmlElement2.InnerText; } else { Log.Warning("Unrecognized EdB Interface preference: " + name); } } } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } } } } } finally { IDisposable disposable2; if ((disposable2 = (enumerator as IDisposable)) != null) { disposable2.Dispose(); } } } catch (Exception arg) { Log.Warning("Exception loading EdB Interface preferences: " + arg); } }
private IValue getcurrentValue(IPreference preference) { IValue currentValue = null; if (preference != null && preference.Values != null && preference.Values.Any()) { currentValue = _Container.GetInstance<IValue>(); currentValue.ID = preference.DefaultValue; currentValue.Name = preference.Values.FirstOrDefault(v => v.ID.Equals(preference.DefaultValue)); } return currentValue; }
protected override void processOneEstimate(float estimatedPreference, IPreference realPref) { double diff = realPref.GetValue() - estimatedPreference; average.AddDatum(diff * diff); }
public void Set(int i, IPreference pref) { id = pref.GetItemID(); ids[i] = pref.GetUserID(); values[i] = pref.GetValue(); }
/// <summary> /// Sets preference at i from information in the given <see cref="IPreference"/> /// </summary> /// <param name="i">index</param> /// <param name="pref">pref</param> public void Set(int i, IPreference pref) { throw new NotImplementedException(); }
protected override void processOneEstimate(float estimatedPreference, IPreference realPref) { average.AddDatum(Math.Abs(realPref.GetValue() - estimatedPreference)); }