public bool ConditionsMet(LayerModel layer, IDataModel dataModel) { lock (layer.Properties.Conditions) { return layer.Properties.Conditions.All(cm => cm.ConditionMet(dataModel)); } }
public void setUpSyntheticData() { int numUsers = 2000; int numItems = 1000; double sparsity = 0.5; this.rank = 20; this.lambda = 0.000000001; this.numIterations = 100; var users = randomMatrix(numUsers, rank, 1); var items = randomMatrix(rank, numItems, 1); var ratings = times(users, items); normalize(ratings, 5); FastByIDMap<IPreferenceArray> userData = new FastByIDMap<IPreferenceArray>(); for (int userIndex = 0; userIndex < numUsers; userIndex++) { List<IPreference> row= new List<IPreference>(); for (int itemIndex = 0; itemIndex < numItems; itemIndex++) { if (random.nextDouble() <= sparsity) { row.Add(new GenericPreference(userIndex, itemIndex, (float) ratings[userIndex, itemIndex])); } } userData.Put(userIndex, new GenericUserPreferenceArray(row)); } dataModel = new GenericDataModel(userData); }
public ActionResult Recommend(string filmIdsJson) { var filmIds = (new JavaScriptSerializer()).Deserialize<long[]>(filmIdsJson); var pathToDataFile = Path.Combine(System.Web.HttpRuntime.AppDomainAppPath, "data/albums.dat"); if (dataModel == null) { try { dataModel = new FileDataModel(pathToDataFile, false, FileDataModel.DEFAULT_MIN_RELOAD_INTERVAL_MS, false); } catch (Exception e) { var exe = e.ToString(); } } var plusAnonymModel = new PlusAnonymousUserDataModel(dataModel); var prefArr = new GenericUserPreferenceArray(filmIds.Length); prefArr.SetUserID(0, PlusAnonymousUserDataModel.TEMP_USER_ID); for (int i = 0; i < filmIds.Length; i++) { prefArr.SetItemID(i, filmIds[i]); prefArr.SetValue(i, 5); // lets assume max rating } plusAnonymModel.SetTempPrefs(prefArr); var similarity = new LogLikelihoodSimilarity(plusAnonymModel); var neighborhood = new NearestNUserNeighborhood(15, similarity, plusAnonymModel); var recommender = new GenericBooleanPrefUserBasedRecommender(plusAnonymModel, neighborhood, similarity); var recommendedItems = recommender.Recommend(PlusAnonymousUserDataModel.TEMP_USER_ID, 5, null); return Json( recommendedItems.Select(ri => new Dictionary<string, object>() { {"id", ri.GetItemID() }, {"rating", ri.GetValue() }, }).ToArray() ); }
public static void Evaluate(IRecommender recommender, IDataModel model, int samples, IRunningAverage tracker, String tag) { printHeader(); var users = recommender.GetDataModel().GetUserIDs(); while (users.MoveNext()) { long userID = users.Current; var recs1 = recommender.Recommend(userID, model.GetNumItems()); IPreferenceArray prefs2 = model.GetPreferencesFromUser(userID); prefs2.SortByValueReversed(); FastIDSet commonSet = new FastIDSet(); long maxItemID = setBits(commonSet, recs1, samples); FastIDSet otherSet = new FastIDSet(); maxItemID = Math.Max(maxItemID, setBits(otherSet, prefs2, samples)); int max = mask(commonSet, otherSet, maxItemID); max = Math.Min(max, samples); if (max < 2) { continue; } long[] items1 = getCommonItems(commonSet, recs1, max); long[] items2 = getCommonItems(commonSet, prefs2, max); double variance = scoreCommonSubset(tag, userID, samples, max, items1, items2); tracker.AddDatum(variance); } }
internal void ApplyProperty(IDataModel dataModel, LayerPropertiesModel properties) { if (LayerPropertyType == LayerPropertyType.PercentageOf) ApplyPercentageOf(dataModel, properties, PercentageSource); if (LayerPropertyType == LayerPropertyType.PercentageOfProperty) ApplyPercentageOfProperty(dataModel, properties); }
public void LoadData(string xmlFileName, string prjId, string tcId, out IDataModel globalData, out IDataModel testData, out System.Data.DataTable controlInfo) { XElement root = XmlHelper.LoadXml(xmlFileName); var prj = XmlHelper.GetElementsByCondition(root, XmlTemplateStruct.ProjectNode, XmlTemplateStruct.ProjectIdProperty, prjId).ToList()[0]; if (null != prj) { var target = prj.Element(XmlTemplateStruct.GlobalDataNode); globalData = new DataModel(TransformNode2DataTable(XmlTemplateStruct.GlobalDataNode, target).Rows[0]); target = prj.Element(XmlTemplateStruct.TestDataNode); var collection = XmlHelper.GetElementsByCondition(target, XmlTemplateStruct.TestDataChildNode, XmlTemplateStruct.TestCaseIdProperty, tcId); if (null != collection) { testData = new DataModel(TransformNode2DataTable(XmlTemplateStruct.TestDataChildNode, collection).Rows[0]); } else throw new System.Exception("Not found node " + XmlTemplateStruct.TestDataChildNode + " under " + XmlTemplateStruct.TestDataNode + " which " + XmlTemplateStruct.TestCaseIdProperty + " = " + tcId); target = prj.Element(XmlTemplateStruct.ControlInfoNode); collection = target.Elements(XmlTemplateStruct.ControlInfoChildNode); controlInfo = TransformNode2DataTable(XmlTemplateStruct.ControlInfoChildNode, collection); } else throw new System.Exception("Not found node " + XmlTemplateStruct.ProjectNode + " which " + XmlTemplateStruct.ProjectIdProperty + " = " + prjId); }
public bool ConditionMet(IDataModel subject) { if (string.IsNullOrEmpty(Field) || string.IsNullOrEmpty(Value) || string.IsNullOrEmpty(Type)) return false; var inspect = GeneralHelpers.GetPropertyValue(subject, Field); if (inspect == null) return false; // Put the subject in a list, allowing Dynamic Linq to be used. if (Type == "String") { return _interpreter.Eval<bool>($"subject.{Field}.ToLower(){Operator}(value)", new Parameter("subject", subject.GetType(), subject), new Parameter("value", Value.ToLower())); } Parameter rightParam = null; switch (Type) { case "Enum": var enumType = GeneralHelpers.GetPropertyValue(subject, Field).GetType(); rightParam = new Parameter("value", Enum.Parse(enumType, Value)); break; case "Boolean": rightParam = new Parameter("value", bool.Parse(Value)); break; case "Int32": rightParam = new Parameter("value", int.Parse(Value)); break; } return _interpreter.Eval<bool>($"subject.{Field} {Operator} value", new Parameter("subject", subject.GetType(), subject), rightParam); }
void SetModel(IDataModel value) { if (model != null) { model.Node = null; model.PropertyChanged -= OnModelPropertyChanged; model.ExpandRequested -= ExpandRequested; model.CollapseRequested -= CollapseRequested; model.Children.CollectionChanged -= OnChildrenUpdated; } model = value; model.Node = this; model.Refresh(true); model.PropertyChanged += OnModelPropertyChanged; model.ExpandRequested += ExpandRequested; model.CollapseRequested += CollapseRequested; model.Children.CollectionChanged += OnChildrenUpdated; Text = model.Text; ForeColor = model.ForeColor; foreach (var child in model.Children) { var childNode = new DataTreeNodeX(child); Nodes.Add(childNode); } ImageIndex = model.HasIcon ? 0 : -1; if (TreeView != null) TreeView.Invalidate(); }
protected EffectModel(MainManager mainManager, EffectSettings settings, IDataModel dataModel) { MainManager = mainManager; Settings = settings; DataModel = dataModel; MainManager.EffectManager.EffectModels.Add(this); }
protected AbstractFactorizer(IDataModel dataModel) { this.dataModel = dataModel; buildMappings(); refreshHelper = new RefreshHelper( () => { buildMappings(); }); refreshHelper.AddDependency(dataModel); }
protected override IDataObject BuildSeriesInternal(IDataObject data, IDataObject configuration, IDataModel dataModel) { var ido = base.BuildSeriesInternal(data, configuration, dataModel); ido[ChartingConstants.StackedSeriesTypePropertyName] = configuration[ChartingConstants.StackedSeriesTypePropertyName] ?? DefaultStackedSeriesType; ido[ChartingConstants.SeriesOrderPropertyName] = configuration[ChartingConstants.SeriesOrderPropertyName] ?? 0; ido[ChartingConstants.StackedSeriesSizePropertyName] = configuration[ChartingConstants.StackedSeriesSizePropertyName] ?? 0; return ido; }
protected override FastIDSet doGetCandidateItems(long[] preferredItemIDs, IDataModel dataModel) { FastIDSet candidateItemIDs = new FastIDSet(); foreach (long itemID in preferredItemIDs) { candidateItemIDs.AddAll(similarity.AllSimilarItemIDs(itemID)); } candidateItemIDs.RemoveAll(preferredItemIDs); return candidateItemIDs; }
public IEnumerable<IView> LocateViews(IDataModel model) { var modelType = model.GetType(); foreach (var viewType in viewMap) { if (!viewType.Key.IsAssignableFrom(modelType)) continue; foreach (var view in viewType.Value) yield return view; } }
/// @param threshold /// similarity threshold /// @param userSimilarity /// similarity metric /// @param dataModel /// data model /// @param samplingRate /// percentage of users to consider when building neighborhood -- decrease to trade quality for /// performance /// @throws IllegalArgumentException /// if threshold or samplingRate is {@link Double#NaN}, or if samplingRate is not positive and less /// than or equal to 1.0, or if userSimilarity or dataModel are {@code null} public ThresholdUserNeighborhood(double threshold, IUserSimilarity userSimilarity, IDataModel dataModel, double samplingRate) : base(userSimilarity, dataModel, samplingRate) { //Preconditions.checkArgument(!Double.isNaN(threshold), "threshold must not be NaN"); this.threshold = threshold; }
protected override FastIDSet doGetCandidateItems(long[] preferredItemIDs, IDataModel dataModel) { FastIDSet possibleItemIDs = new FastIDSet(dataModel.GetNumItems()); var allItemIDs = dataModel.GetItemIDs(); while (allItemIDs.MoveNext()) { possibleItemIDs.Add(allItemIDs.Current); } possibleItemIDs.RemoveAll(preferredItemIDs); return possibleItemIDs; }
public RCollection(PBaseObject owner, string name, bool deferredLoad, IDataModel model) { _items = new List<PBaseObject>(); Owner = owner; Name = name; _deferredLoad = deferredLoad; _loaded = false; _model = model; }
private void LoadData(string connectionString, string prjId, string tcId, out IDataModel global, out IDataModel local) { string sql = "select " + SqlFunc4Data.Name + "," + SqlFunc4Data.Value + "," + SqlFunc4Data.IsGlobal + " from " + SqlFunc4Data.FuncInDB + "(" + prjId + "," + tcId + ")"; DataTable dt = SqlHelper.GetDataTableBySql(connectionString, sql); global = ConvertDataTabel2DataModel(dt, true); local = ConvertDataTabel2DataModel(dt, false); }
public void LoadData(string xlsFileName, string prjId, string tcId, out IDataModel globalData, out IDataModel testData, out DataTable controlInfo) { globalData = null; testData = null; controlInfo = null; string connectionString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + xlsFileName + "; Extended Properties='Excel 8.0;IMEX=1';"; using (OleDbConnection connection = new OleDbConnection(connectionString)) { if (connection.State != ConnectionState.Open) connection.Open(); var tb = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); using (OleDbCommand command = new OleDbCommand()) { foreach (DataRow row in tb.Rows) { var dt = new DataTable(); string conditionColumn = XlsGlobalDataStruct.ProjectId, comparedValue = prjId;//"'" + prjId + "'"; string sheetname = row["TABLE_NAME"].ToString(); command.Connection = connection; if (sheetname.Contains(XlsGlobalDataStruct.TableOrSheet) || sheetname.Contains(XlsControlInfoStruct.TableOrSheet)) { command.CommandText = "SELECT * FROM [" + sheetname + "] where " + conditionColumn + " = " + comparedValue; } else if (sheetname.Contains(XlsTestDataStruct.TableOrSheet)) { string andConditionString = XlsTestDataStruct.TestCaseId + " = " + tcId;//'" + tcId + "'"; command.CommandText = "SELECT * FROM [" + sheetname + "] where " + conditionColumn + " = " + comparedValue + " AND " + andConditionString; } else throw new System.Exception("All sheets should call " + XlsGlobalDataStruct.TableOrSheet + ", " + XlsTestDataStruct.TableOrSheet + ", or " + XlsControlInfoStruct.TableOrSheet + ".Please check sheet name again!"); using (OleDbDataAdapter adapter = new OleDbDataAdapter()) { adapter.SelectCommand = command; adapter.Fill(dt); dt.TableName = sheetname.Replace("$", ""); if (sheetname.Contains(XlsGlobalDataStruct.TableOrSheet)) { var dr = FillDataRow(dt); globalData = new DataModel(dr); } else if (sheetname.Contains(XlsTestDataStruct.TableOrSheet)) { var dr = FillDataRow(dt); testData = new DataModel(dr); } else if (sheetname.Contains(XlsControlInfoStruct.TableOrSheet)) { controlInfo = dt; } } } } } }
public ALSWRFactorizer(IDataModel dataModel, int numFeatures, double lambda, int numIterations, bool usesImplicitFeedback, double alpha, int numTrainingThreads) : base(dataModel) { this.dataModel = dataModel; this.numFeatures = numFeatures; this.lambda = lambda; this.numIterations = numIterations; this.usesImplicitFeedback = usesImplicitFeedback; this.alpha = alpha; this.numTrainingThreads = numTrainingThreads; }
public ListViewFormPresenter(IView pView, IDataModel pModel) { _listView = pView; _model = pModel; _listView.MoveToSourceRequested += _listView_DestinationUpdated; _listView.MoveToDestinationRequested += _listView_SourceListUpdated; _listView.AllCleared += _listView_AllCleared; _listView.FolderSelected += _listView_FolderSelected; }
public HistoryItem Record(IDataModel model) { var item = new HistoryItem(model); var newNode = new HistoryNode(item); if (current != null) { current.Next = newNode; newNode.Previous = current; } current = newNode; return item; }
public AbstractUserNeighborhood(IUserSimilarity userSimilarity, IDataModel dataModel, double samplingRate) { //Preconditions.checkArgument(userSimilarity != null, "userSimilarity is null"); //Preconditions.checkArgument(dataModel != null, "dataModel is null"); //Preconditions.checkArgument(samplingRate > 0.0 && samplingRate <= 1.0, "samplingRate must be in (0,1]"); this.userSimilarity = userSimilarity; this.dataModel = dataModel; this.samplingRate = samplingRate; this.refreshHelper = new RefreshHelper(null); this.refreshHelper.AddDependency(this.dataModel); this.refreshHelper.AddDependency(this.userSimilarity); }
public void Update(LayerModel layerModel, IDataModel dataModel, bool isPreview = false) { layerModel.AppliedProperties = new KeyboardPropertiesModel(layerModel.Properties); if (isPreview || dataModel == null) return; // If not previewing, apply dynamic properties according to datamodel var keyboardProps = (KeyboardPropertiesModel) layerModel.AppliedProperties; foreach (var dynamicProperty in keyboardProps.DynamicProperties) dynamicProperty.ApplyProperty(dataModel, layerModel.AppliedProperties); }
/// <p> /// Creates a possibly weighted {@link AbstractSimilarity}. /// </p> public AbstractSimilarity(IDataModel dataModel, Weighting weighting, bool centerData) : base(dataModel) { this.weighted = weighting == Weighting.WEIGHTED; this.centerData = centerData; this.cachedNumItems = dataModel.GetNumItems(); this.cachedNumUsers = dataModel.GetNumUsers(); this.refreshHelper = new RefreshHelper( () => { cachedNumItems = dataModel.GetNumItems(); cachedNumUsers = dataModel.GetNumUsers(); } ); }
public RatingSGDFactorizer(IDataModel dataModel, int numFeatures, double learningRate, double preventOverfitting, double randomNoise, int numIterations, double learningRateDecay) : base(dataModel) { this.dataModel = dataModel; this.numFeatures = numFeatures + FEATURE_OFFSET; this.numIterations = numIterations; this.learningRate = learningRate; this.learningRateDecay = learningRateDecay; this.preventOverfitting = preventOverfitting; this.randomNoise = randomNoise; }
protected override FastIDSet doGetCandidateItems(long[] preferredItemIDs, IDataModel dataModel) { FastIDSet possibleItemsIDs = new FastIDSet(); foreach (long itemID in preferredItemIDs) { IPreferenceArray itemPreferences = dataModel.GetPreferencesForItem(itemID); int numUsersPreferringItem = itemPreferences.Length(); for (int index = 0; index < numUsersPreferringItem; index++) { possibleItemsIDs.AddAll(dataModel.GetItemIDsFromUser(itemPreferences.GetUserID(index))); } } possibleItemsIDs.RemoveAll(preferredItemIDs); return possibleItemsIDs; }
public bool ConditionsMet(LayerModel layer, IDataModel dataModel) { lock (layer.Properties.Conditions) { var conditionsMet = layer.Properties.Conditions.All(cm => cm.ConditionMet(dataModel)); layer.EventProperties.Update(layer, conditionsMet); if (conditionsMet && layer.EventProperties.CanTrigger) layer.EventProperties.TriggerEvent(layer); return layer.EventProperties.MustDraw; } }
/// <summary> /// Initializes the view model /// </summary> /// <param name="dataModel">The IDataModel to use in the view model</param> public SPMSViewModel(IDataModel dataModel) { _dataModel = dataModel; _isLoggedIn = false; // Set all the observable collections to empty lists _projectsForUser = new ObservableCollection<ProjectView>(); _sprintsForProject = new ObservableCollection<SprintView>(); _storiesForSprint = new ObservableCollection<StoryView>(); _tasksForStory = new ObservableCollection<TaskView>(); _tasksForUser = new ObservableCollection<TaskView>(); _allTeams = new ObservableCollection<TeamView>(); }
public FastIDSet GetRelevantItemsIDs(long userID, int at, double relevanceThreshold, IDataModel dataModel) { IPreferenceArray prefs = dataModel.GetPreferencesFromUser(userID); FastIDSet relevantItemIDs = new FastIDSet(at); prefs.SortByValueReversed(); for (int i = 0; i < prefs.Length() && relevantItemIDs.Count() < at; i++) { if (prefs.GetValue(i) >= relevanceThreshold) { relevantItemIDs.Add(prefs.GetItemID(i)); } } return relevantItemIDs; }
public Result RecommendPearsonCorrelationSimilarity(int userId, int movieId) { Result result = new Result(); dataModel = new FileDataModel(PathToDataFile, false, FileDataModel.DEFAULT_MIN_RELOAD_INTERVAL_MS, false, ",", userId, movieId); var removedPrefs = GenericDataModel.preferenceFromUsersRemoved.Values; var valueToCompare = removedPrefs.FirstOrDefault(i => i.GetItemID() == movieId).GetValue(); var similarity = new PearsonCorrelationSimilarity(dataModel); var recommender = new GenericItemBasedRecommender(dataModel, similarity); var preferences = recommender.EstimatePreference(userId, movieId); result.PredictedValue = preferences; result.RealValue = removedPrefs.First().GetValue(); return result; }
public ContainerGroupController(IDataModel db) { _Db = db; }
void WriteDataModel(IDataModel model, TextWriter writer) { // Write data to output writer.Write(JsonConvert.SerializeObject(model.Root, JsonHelpers.StandardSerializerSettings)); }
protected ITableRun GetTable(IDataModel model, int pointerAddress) => (ITableRun)model.GetNextRun(pointerAddress);
public void Clear(IDataModel model, ModelDelta changeToken, int start, int length) { ITableRunExtensions.Clear(this, model, changeToken, start, length); }
public IRecommender BuildRecommender(IDataModel dataModel) { return(new GenericBooleanPrefItemBasedRecommender(dataModel, new LogLikelihoodSimilarity(dataModel))); }
public override AppliedProperties GetAppliedProperties(IDataModel dataModel, bool ignoreDynamic = false) { return(new AppliedProperties { Brush = Brush }); }
public PlusAnonymousUserDataModel(IDataModel deleg) { this._delegate = deleg; this.prefItemIDs = new FastIDSet(); }
public DataModelNode(DocumentIdNode documentIdNode, IDataModel dataModel) { documentIdNode.SaveToSlot(out _documentIdSlot); _dataModel = dataModel; Data = dataModel.Data.AsArrayOf <IData, DataNode>(true); }
public UIGroup(string name, View view, ViewModel viewModel, IDataModel model) : base(name, view, viewModel, model) { }
public static void FillData(IDataModel model, IObject thisPage, Type thisType) { }
public String CreateDataModelScript(IDataModel model) { return(model != null?model.CreateScript(this) : CreateEmptyStript()); }
/// <summary> /// Uses the hint, as well as this sprite's table location (if any), to find palettes that can be applied to this sprite. /// (1) if the sprite's hint is the name of a palette, return that. Example: title screen pokemon sprite/palette pair. /// (2) if the sprite's hint is the name of an enum table, use that enum's source as a list of palettes and get the appropriate one from the matching index of the enum table. Example: pokemon icons /// (3) if the sprite's hint is a table name followed by a key=value pair, go grab the a palette from the element within that table such that it's key equals that value. Example: Overworld sprites /// (4) if the sprite's hint is a table name, return all palettes within the matching index of that table. Example: trainer sprites/palettes. /// (5) if the sprite has no hint, return all palettes in arrays with matching length from the same index. Example: pokemon sprites. Leaving it empty allows both normal and shiny palettes to match. /// </summary> public static IReadOnlyList <IPaletteRun> FindRelatedPalettes(this ISpriteRun spriteRun, IDataModel model, int primarySource = -1, string hint = null, bool includeAllTableIndex = false) { // find all palettes that could be applied to this sprite run var noChange = new NoDataChangeDeltaModel(); var results = new List <IPaletteRun>(); if (spriteRun?.SpriteFormat.BitsPerPixel < 4) { return(results); // 1- and 2-bit sprites don't have palettes } hint = hint ?? spriteRun?.SpriteFormat.PaletteHint; if (primarySource == -1) { var pointerCount = spriteRun?.PointerSources?.Count ?? 0; for (int i = 0; i < pointerCount; i++) { if (!(model.GetNextRun(spriteRun.PointerSources[i]) is ArrayRun)) { continue; } primarySource = spriteRun.PointerSources[i]; break; } } var spriteTable = model.GetNextRun(primarySource) as ITableRun; var offset = spriteTable?.ConvertByteOffsetToArrayOffset(primarySource) ?? new ArrayOffset(-1, -1, -1, -1); if (primarySource < 0) { offset = new ArrayOffset(-1, -1, -1, -1); } if (!string.IsNullOrEmpty(hint)) { var address = model.GetAddressFromAnchor(noChange, -1, hint); var run = model.GetNextRun(address); if (run is IPaletteRun palRun && palRun.Start == address) { // option 1: hint is to a palette results.Add(palRun); return(results); } else if (run is ArrayRun enumArray && enumArray.ElementContent.Count == 1 && enumArray.ElementContent[0] is ArrayRunEnumSegment enumSegment) { // option 2: hint is to index into paletteTable, and I'm in a table var paletteTable = model.GetNextRun(model.GetAddressFromAnchor(noChange, -1, enumSegment.EnumName)) as ITableRun; if (offset.ElementIndex != -1 && paletteTable != null) { var paletteIndex = model.ReadMultiByteValue(enumArray.Start + enumArray.ElementLength * offset.ElementIndex, enumArray.ElementLength); var destination = model.ReadPointer(paletteTable.Start + paletteTable.ElementLength * paletteIndex); var tempRun = model.GetNextRun(destination); if (tempRun is IPaletteRun pRun && pRun.Start == destination) { results.Add(pRun); } } }
public HeadsetPropertiesViewModel(IDataModel dataModel, LayerPropertiesModel properties) : base(dataModel) { ProposedProperties = GeneralHelpers.Clone(properties); Brush = ProposedProperties.Brush.CloneCurrentValue(); }
public DialogDebugAdapter(int port, ISourceMap sourceMap, IBreakpoints breakpoints, Action terminate, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null, ICoercion coercion = null) : base(logger) { this.events = events ?? new Events <DialogEvents>(); this.codeModel = codeModel ?? new CodeModel(); this.dataModel = dataModel ?? new DataModel(coercion ?? new Coercion()); this.sourceMap = sourceMap ?? throw new ArgumentNullException(nameof(sourceMap)); this.breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(breakpoints)); this.terminate = terminate ?? new Action(() => Environment.Exit(0)); this.task = ListenAsync(new IPEndPoint(IPAddress.Any, port), cancellationToken.Token); this.arenas.Add(output); }
/// <p> /// Builds a list of item-item similarities given an {@link ItemSimilarity} implementation and a /// {@link DataModel}, rather than a list of {@link ItemItemSimilarity}s. /// </p> /// /// <p> /// It's valid to build a {@link GenericItemSimilarity} this way, but perhaps missing some of the point of an /// item-based recommender. Item-based recommenders use the assumption that item-item similarities are /// relatively fixed, and might be known already independent of user preferences. Hence it is useful to /// inject that information, using {@link #GenericItemSimilarity(Iterable)}. /// </p> /// /// @param otherSimilarity /// other {@link ItemSimilarity} to get similarities from /// @param dataModel /// data model to get items from /// @throws TasteException /// if an error occurs while accessing the {@link DataModel} items public GenericItemSimilarity(IItemSimilarity otherSimilarity, IDataModel dataModel) { long[] itemIDs = GenericUserSimilarity.longIteratorToList(dataModel.GetItemIDs()); initSimilarityMaps(new DataModelSimilaritiesIterator(otherSimilarity, itemIDs)); }
/// <summary> /// Attempt to parse the existing data into a run of the desired type. /// </summary> public abstract ErrorInfo TryParseData(IDataModel model, string name, int dataIndex, ref IFormattedRun run);
public ModelCacheScope(IDataModel model) => this.model = model;
/// <summary> /// A pointer format in a table has changed. /// Replace the given run with a new run of the appropriate format. /// </summary> public abstract void UpdateNewRunFromPointerFormat(IDataModel model, ModelDelta token, string name, IReadOnlyList <ArrayRunElementSegment> sourceSegments, int parentIndex, ref IFormattedRun run);
public String CreateServerScript(IDataModel model, String template) { throw new NotImplementedException(); }
public void AppendTo(IDataModel model, StringBuilder builder, int start, int length, bool deep) { ITableRunExtensions.AppendTo(this, model, builder, start, length, deep); }
public void LoadData(string connectionString, string prjId, string tcId, out IDataModel globalData, out IDataModel testData, out DataTable controlInfo) { LoadData(connectionString, prjId, tcId, out globalData, out testData); LoadControlInfo(connectionString, prjId, out controlInfo); }
/// <summary> /// Create a new run meant to go into a pointer in a table. /// The destination has been prepared, but is all FF. /// </summary> public abstract IFormattedRun WriteNewRun(IDataModel owner, ModelDelta token, int source, int destination, string name, IReadOnlyList <ArrayRunElementSegment> sourceSegments);
public override IFormattedRun WriteNewRun(IDataModel owner, ModelDelta token, int source, int destination, string name, IReadOnlyList <ArrayRunElementSegment> sourceSegments) { // don't bother checking the TryParse result: we very much expect that the data originally in the run won't fit the parse. TableStreamRun.TryParseTableStream(owner, destination, new SortedSpan <int>(source), name, Format, sourceSegments, out var tableStream); return(tableStream.DeserializeRun("", token)); }
public DummySimilarity(IDataModel dataModel) : base(dataModel) { }
/// <summary> /// Returns true if the format is capable of being added for the pointer at source. /// If the token is such that edits are allowed, actually add the format. /// </summary> public abstract bool TryAddFormatAtDestination(IDataModel owner, ModelDelta token, int source, int destination, string name, IReadOnlyList <ArrayRunElementSegment> sourceSegments, int parentIndex);
/// <summary> /// If a 'default' run is created for the pointer at the given address, how many bytes need to be available at the destination location? /// </summary> public abstract int LengthForNewRun(IDataModel model, int pointerAddress);
/// <summary> /// Determines whether [is empty model]. /// </summary> /// <param name="dataModel">The data model.</param> /// <returns> /// <c>true</c> if [is empty model] [the specified data model]; otherwise, <c>false</c>. /// </returns> public static bool IsEmptyModel(this IDataModel dataModel) => dataModel is EmptyModel;
public GenericBooleanPrefUserBasedRecommender(IDataModel dataModel, IUserNeighborhood neighborhood, IUserSimilarity similarity) : base(dataModel, neighborhood, similarity) { }
public void AddItem(IDataModel model) { _cache.Set <IDataModel>(model.Id.ToString(), model); }