public Task(TaskType type, Connection client = null, object args = null) { Type = type; _client = client; _args = args; Query = null; }
public Task(string name, bool isimportant, bool ishard, int estimatetomato, TaskType tasktype, TaskPriority taskpri, TaskStatus taskstatus = TaskStatus.INQUEUE, DateTime? reminder = null) { this.name = name; this.isImportant = isimportant ? "important" : "not important"; this.isHard = ishard ? "hard" : "easy"; this.estimateToamto = estimatetomato; this.completeTomato = 0; this.incompleteTomato = 0; this.innerBreak = 0; this.outterBreak = 0; this.completeness = 0; this.difficulties = 0; this.satisfaction = 0; this.efficiency = 0; this.improvement = 0; this.achivement = 0; this.focusness = 0; this.taskStatus = taskstatus; this.taskType = tasktype; this.taskPriority = taskpri; }
/// <summary> /// Létrehoz egy feladatot a megadott típussal és célponttal /// </summary> /// <param name="Type">A feladat típusa</param> /// <param name="Item">A feladat célpontja</param> public Task(TaskType Type, Items.ItemBase Item) { if (Type == TaskType.Any) { throw new ArgumentException("TaskType.Any cannot be used here"); } this.Type = Type; this.Item = Item; this.AssignedSince = Statistics.CurrentLoop; }
public WorkerTask(BackgroundWorker worker, TaskType task) { this.MyWorker = worker; this.Task = task; this.FileOrDirPaths = new List<string>(); this.MediaOptions = new MediaWizardOptions(); }
public Task(string name, string description, int priority, TaskType type) { _name = name; _description = description; _priority = priority; _type = type; }
public bool addHeldPoints(TaskType type, int amount) { switch (type) { case TaskType.Attendance: freezeInfo.attendanceScore += amount; break; case TaskType.Cooperation: freezeInfo.cooperationScore += amount; break; case TaskType.CrossCurricular: freezeInfo.crossCurricularScore += amount; break; case TaskType.Puzzle: freezeInfo.puzzleScore += amount; break; case TaskType.Story: freezeInfo.storyScore += amount; break; default: return false; } return true; }
public static int GetCount(TaskType type) { if (!taskCount.ContainsKey(type)) { return 0; } return taskCount[type]; }
public static AbstractTask CreateTaskByType(TaskType type) { if (type == TaskType.DefaultTask) return new DefaultTask(); return null; }
public Task(TaskType type, HTTPAgent.FileType fileType, long fileId, string fileTitle) { mType = type; mFileType = fileType; mFileId = fileId; mFileTitle = fileTitle; }
/// <summary> /// /// </summary> /// <param name="opcode"></param> /// <param name="type">消息的处理方法</param> /// <param name="taskType">任务分类</param> /// <param name="isVerifyLogin">是否进行登录验证,默认是进行的,只有登录等极少数的消息是不需要验证的</param> public NetMethodAttribute(ushort opcode, NetMethodType type, TaskType taskType, bool isVerifyLogin = true) { OpCode = opcode; MethodType = type; IsVerifyLogin = isVerifyLogin; TaskType = taskType; }
void OnGUI() { type = (TaskType)EditorGUILayout.EnumPopup("Task Type", type); taskName = EditorGUILayout.TextField("Task Name", taskName); ns = EditorGUILayout.TextField("Namespace", ns); category = EditorGUILayout.TextField("Category(?)", category); description = EditorGUILayout.TextField("Description(?)", description); agentType = EditorGUILayout.TextField("Agent Type(?)", agentType); if (GUILayout.Button("CREATE")){ if (string.IsNullOrEmpty(taskName)){ EditorUtility.DisplayDialog("Empty Task Name", "Please give the new task a name","OK"); return; } if (type == TaskType.Action) CreateFile(GetActionTemplate()); if (type == TaskType.Condition) CreateFile(GetCoditionTemplate()); taskName = ""; GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; } if (type == TaskType.Action) GUILayout.Label(GetActionTemplate()); if (type == TaskType.Condition) GUILayout.Label(GetCoditionTemplate()); }
public void AddTask(TaskType Type, object[] Args) { Task t = new Task(qu.Count, Type, Args); qu.Add(t); try { Changed(t); } catch { } }
public Task(TextBox textBox, string command, Label label, TaskType taskType, ref bool running) { TextBox = textBox; Command = command; Label = label; TaskType = taskType; Running = running; }
public TaskFromAsyncTest(TestParameters parameters) { _api = parameters.Api; _sourceType = parameters.SourceTaskType; _fromAsyncType = parameters.FromAsyncTaskType; _errorCase = parameters.ErrorCase; _overloadChoice = parameters.OverloadChoice; }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="priority"></param> /// <param name="taskType"></param> /// <param name="onPacketReceive"></param> internal PacketHandler(ushort iPacketID, PacketPriority priority, TaskType taskType, PacketReceiveCallback onPacketReceive) { m_PacketID = iPacketID; m_PacketPriority = priority; m_OnReceive = onPacketReceive; m_TaskType = taskType; }
public UpdateTaskCommand(int taskId, string name, TaskType type, TaskCategory category, int orderId) { this.taskId = taskId; this.name = name; this.type = type; this.category = category; this.orderId = orderId; }
public static TaskType FromDTO(this DTO.TaskType source) { var h = new TaskType(); h.TypeName = source.TypeName; if (source.AnyAttr != null) h.AnyAttr = source.AnyAttr.ToList(); return h; }
private void FillControl() { postID = Request.QueryString["TaskID"]; if (string.IsNullOrEmpty(postID)) { Response.Redirect("default.aspx", true); } try { DataTable dt = taskDal.GetTaskByID(Convert.ToInt32(postID)); if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; this.lblTitle.Text = row["Title"].ToString(); this.lblContent.Text = row["Content"].ToString(); this.lblCreateTime.Text = row["CreateTime"] == DBNull.Value ? "" : row["CreateTime"].ToString(); this.lblComTime.Text = row["CompleteTime"] == DBNull.Value ? "" : row["CompleteTime"].ToString(); hidTaskUser.Value = row["userid"] == DBNull.Value ? "" : row["userid"].ToString(); string status = row["status"].ToString(); string typeID = hidTypeID.Value = row["TypeID"] == DBNull.Value ? "0" : row["TypeID"].ToString(); string processID = row["ProcessID"].ToString(); lblStatus.Text = status; hidID.Value = postID; // ddlProcessType.ProcessingID = status; lblAuthor.Text = hidTaskUser.Value; if (this.lblComTime.Text.Length == 0) { //this.lblComTime.Text = "not completed"; } string attachment = row["FileName"] == DBNull.Value ? "" : row["FileName"].ToString(); if (attachment.Length > 0) { this.linkAttachment.Text = attachment; } TaskType t = new TaskType(typeID); if (t.TaskStatus != TaskType.Task.Task) { this.lblStatusMessage.Visible = false; this.lblStatus.Visible = false; this.lblComTime.Visible = false; lblCompleteTime.Visible = false; } foreach (ListItem il in this.ddlProcessType.Items) { if (il.Value == processID) { il.Selected = true; break; } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
public void EditUserTaskProgress(Guid userId, TaskType type, int value) { Tasks task = _task.FirstOrDefault(X => X.UserId == userId && X.Type == type); if (task != null) { task.Progress = value; _uow.SaveChanges(); } }
public string CheckValidity(string message, TaskType taskType) { if (taskType == TaskType.Ping) { return CheckValidPing(message); } else if (taskType == TaskType.Dns) { return CheckValidDns(message); } return _statusBad; }
/// <summary> /// Create method constructer parameters /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="description"></param> /// <param name="type"></param> /// <param name="user"></param> /// <param name="state"></param> /// <param name="completedPercent"></param> public Task(int id, string name, string description, TaskType type, List<User> user, TaskState state, int completedPercent) { TaskId = id; Name = name; Description = description; Type = type; Users = user; State = state; CompletedPercent = completedPercent; }
/// <summary> /// Hinzufügen von Broadcast, ChatMessage oder Command. /// </summary> /// <param name="Type"></param> /// <param name="Name"></param> /// <param name="Command"></param> /// <param name="Interval"></param> /// <param name="Time"></param> public ServerTask(int Id, TaskType Type, string Name, string Command, Interval Interval , DateTime Time) { this.Id = Id; this.Type = Type; this.Name = Name; this.Command = Command; this.Interval = Interval; this.Time = Time; timer = new Timer(new TimerCallback(ExecuteTask), null, Timeout.Infinite, Timeout.Infinite); }
public Task(string fileName, string description, int column, int line) { if (fileName != null) type = TaskType.SearchResult; else type = TaskType.Comment; this.fileName = fileName; this.description = description.Trim(); this.column = column; this.line = line; }
public Task(Project project, CompilerError error) { this.project = project; type = error.IsWarning ? error.ErrorNumber == "COMMENT" ? TaskType.Comment : TaskType.Warning : TaskType.Error; column = error.Column; line = error.Line; description = error.ErrorText; if (error.ErrorNumber != String.Empty) description += "(" + error.ErrorNumber + ")"; fileName = error.FileName; }
public WeakAction(Delegate handler, Type actionType, TaskType taskType) { if (handler.Method.IsStatic) _ownerType = handler.Method.DeclaringType; else _target = new WeakReference(handler.Target); _methodName = handler.Method.Name; _actionType = actionType; _taskType = taskType; }
public void TaskTypeConstructorTests() { // Arrange var expectedDescription = "Test Task Type"; // Act var taskType = new TaskType(expectedDescription); var actual = taskType.Description; // Assert Assert.AreEqual(expectedDescription, actual); }
// TODO: Convert Tasks private ITaskTypeExec GetTaskTypeExec(TaskType taskType) { object o = Assemblies.GetInstance(taskType.AssemblyName, taskType.ClassName); try { ITaskTypeExec res = (ITaskTypeExec) o; return res; } catch (Exception) { return null; } }
public int Execute(TaskType taskType) { switch (taskType) { case TaskType.Archive: { ExecuteArchiveTasks(); break; } case TaskType.NewDay: { ExecuteNewDayTask(); break; } case TaskType.Weekly: { ExecuteWeeklyTask(); break; } case TaskType.Request: { ExecuteRequestTask(); break; } case TaskType.DupeNewDir: { return ExecuteDupeNewDirTask() ? Constants.CodeOk : Constants.CodeFail; } case TaskType.DupeDelDir: { return ExecuteDupeDelDirTask() ? Constants.CodeOk : Constants.CodeFail; } case TaskType.DupeList: { ExecuteDupeListTask(); break; } case TaskType.DupeRemove: { ExecuteDupeRemoveTask(); break; } default: { throw new NotSupportedException("Unknown TaskType"); } } return Constants.CodeOk; }
/// <summary> /// 创建任务标准 /// </summary> /// <param name="name">名称</param> /// <param name="description">描述</param> /// <param name="optimistic">乐观时间</param> /// <param name="pessimistic">悲观时间</param> /// <param name="nomal">正常时间</param> /// <param name="isCustom">是否自定义</param> /// <param name="taskType">任务类型</param> /// <returns>新的标准任务</returns> public static TaskStandard CreateTaskStandard(string name, string description, TimeSpan optimistic, TimeSpan pessimistic, TimeSpan nomal, bool isCustom, TaskType taskType) { var task = new TaskStandard { Name = name, Description = description, OptimisticTime = optimistic, PessimisticTime = pessimistic, NormalTime = nomal, IsCustom = isCustom, TaskType = taskType }; task.GenerateNewIdentity(); return task; }
/// <summary> /// Initializes a new instance of the <see cref="ApiTask" /> class. /// </summary> /// <param name="dynamicProperties">dynamicProperties.</param> /// <param name="id">id.</param> /// <param name="title">title.</param> /// <param name="description">description.</param> /// <param name="requestGuid">requestGuid.</param> /// <param name="status">status.</param> /// <param name="serviceType">serviceType.</param> /// <param name="comments">comments.</param> /// <param name="allComments">allComments.</param> /// <param name="errorMessage">errorMessage.</param> /// <param name="lastModifiedTime">lastModifiedTime.</param> /// <param name="taskType">taskType.</param> /// <param name="allowReassign">allowReassign.</param> /// <param name="allowEdit">allowEdit.</param> /// <param name="dynamicActions">dynamicActions.</param> public ApiTask(ApiTaskDynamicProperties dynamicProperties = default(ApiTaskDynamicProperties), Guid id = default(Guid), string title = default(string), string description = default(string), Guid requestGuid = default(Guid), TaskResult status = default(TaskResult), ServiceType serviceType = default(ServiceType), string comments = default(string), List <TaskComment> allComments = default(List <TaskComment>), string errorMessage = default(string), DateTime lastModifiedTime = default(DateTime), TaskType taskType = default(TaskType), bool allowReassign = default(bool), bool allowEdit = default(bool), List <TaskDynamicActions> dynamicActions = default(List <TaskDynamicActions>)) { this.DynamicProperties = dynamicProperties; this.Title = title; this.Description = description; this.Comments = comments; this.AllComments = allComments; this.ErrorMessage = errorMessage; this.DynamicActions = dynamicActions; this.DynamicProperties = dynamicProperties; this.Id = id; this.Title = title; this.Description = description; this.RequestGuid = requestGuid; this.Status = status; this.ServiceType = serviceType; this.Comments = comments; this.AllComments = allComments; this.ErrorMessage = errorMessage; this.LastModifiedTime = lastModifiedTime; this.TaskType = taskType; this.AllowReassign = allowReassign; this.AllowEdit = allowEdit; this.DynamicActions = dynamicActions; }
public static IEnumerable <TodoTask> FilterByTaskType(this IEnumerable <TodoTask> tasks, TaskType taskType) { return(tasks.Where(t => t.Type == taskType)); }
/// <summary> /// Task kezelő osztály eltávolítása az adott tasktípusról /// </summary> /// <param name="taskType">Task típusa</param> public static void RemoveTask(TaskType taskType) { s_tasks.Remove(taskType); }
public TaskInfo(TaskType t, int v) { type = t; value = v; }
internal TaskBox(int taskID, string brief, string summary, string assignee, string reviewer, DateTime dueDate, TaskType taskType) { ID = taskID; Brief = brief; Summary = summary; Assignee = assignee; Reviewer = reviewer; DueDate = dueDate; TaskType = taskType; }
/// <exception cref="System.IO.IOException"/> public override void ReadFields(DataInput @in) { base.ReadFields(@in); jobId.ReadFields(@in); type = WritableUtils.ReadEnum <TaskType>(@in); }
internal TaskAgnosticAutoFit(TaskType taskType, MLContext context) { _taskType = taskType; _context = context; }
public DataTable getUserTasks(Users user, WorkType workType, Project project, TaskType taskType, DateTime start, DateTime end) { DataTable dataTable = new DataTable(); dataTable.Columns.Add("ID"); dataTable.Columns.Add("Employee Number"); dataTable.Columns.Add("Date"); dataTable.Columns.Add("Task"); dataTable.Columns.Add("Project"); dataTable.Columns.Add("Work Type"); dataTable.Columns.Add("Details"); dataTable.Columns.Add("Start Time"); dataTable.Columns.Add("End Time"); if (getProductionBean().getUserTasks(user, workType, project, taskType, start, end).Count > 0) { foreach (UserTask userTask in getProductionBean().getUserTasks(user, workType, project, taskType, start, end)) { dataTable.Rows.Add(new object[] { userTask.id, String.Format("{0:MM/dd/yy}", userTask.createdDate), getFullName(userTask.user), userTask.taskType.name, userTask.project.name, userTask.workType.name, userTask.description, userTask.startDateTime, userTask.endDateTime }); } } return(dataTable); }
public TaskEntityToken(TaskType type, string id) { TaskType = type; _id = id; }
public ushort Read(int address, TaskType task, bool extendedMemoryReference) { // keyboard word is inverted return((ushort)~_keyWords[address - 0xfe1c]); // TODO: move to constant. }
/// <exception cref="System.IO.IOException"/> /// <exception cref="System.Exception"/> public override TaskReport[] GetTaskReports(JobID jobID, TaskType taskType) { return(clientCache.GetClient(jobID).GetTaskReports(jobID, taskType)); }
/// <summary> /// Features: x1, x2, x3, xRand; y = 10*x1 + 20x2 + 5.5x3 + e, xRand- random and Label y is to dependant on xRand. /// xRand has the least importance: Evaluation metrics do not change a lot when xRand is permuted. /// x2 has the biggest importance. /// </summary> private IDataView GetDenseDataset(TaskType task = TaskType.Regression) { Contracts.Assert(task != TaskType.Clustering, $"TaskType {nameof(TaskType.Clustering)} not supported."); // Setup synthetic dataset. const int numberOfInstances = 1000; var rand = new Random(10); float[] yArray = new float[numberOfInstances], x1Array = new float[numberOfInstances], x2Array = new float[numberOfInstances], x3Array = new float[numberOfInstances], x4RandArray = new float[numberOfInstances]; for (var i = 0; i < numberOfInstances; i++) { var x1 = rand.Next(1000); x1Array[i] = x1; var x2Important = rand.Next(10000); x2Array[i] = x2Important; var x3 = rand.Next(5000); x3Array[i] = x3; var x4Rand = rand.Next(1000); x4RandArray[i] = x4Rand; var noise = rand.Next(50); yArray[i] = (float)(10 * x1 + 20 * x2Important + 5.5 * x3 + noise); } // If binary classification, modify the labels if (task == TaskType.BinaryClassification || task == TaskType.MulticlassClassification) { GetBinaryClassificationLabels(yArray); } else if (task == TaskType.Ranking) { GetRankingLabels(yArray); } // Create data view. var bldr = new ArrayDataViewBuilder(Env); bldr.AddColumn("X1", NumberType.Float, x1Array); bldr.AddColumn("X2Important", NumberType.Float, x2Array); bldr.AddColumn("X3", NumberType.Float, x3Array); bldr.AddColumn("X4Rand", NumberType.Float, x4RandArray); bldr.AddColumn("Label", NumberType.Float, yArray); if (task == TaskType.Ranking) { bldr.AddColumn("GroupId", NumberType.U4, CreateGroupIds(yArray.Length)); } var srcDV = bldr.GetDataView(); var pipeline = ML.Transforms.Concatenate("Features", "X1", "X2Important", "X3", "X4Rand") .Append(ML.Transforms.Normalize("Features")); // Create a keytype for Ranking if (task == TaskType.Ranking) { return(pipeline.Append(ML.Transforms.Conversion.MapValueToKey("GroupId")) .Fit(srcDV).Transform(srcDV)); } return(pipeline.Fit(srcDV).Transform(srcDV)); }
public WorkerTask(BackgroundWorker worker, TaskType task) { this.MyWorker = worker; this.Task = task; this.FileOrDirPaths = new List <string>(); }
/// <summary> /// Gets the character representing the /// <see cref="TaskType"/> /// </summary> /// <param name="type">the TaskType</param> /// <returns>the character</returns> public static char GetRepresentingCharacter(TaskType type) { return(TaskID.CharTaskTypeMaps.GetRepresentingCharacter(type)); }
public Task(TaskType Type, string Description) { this.Type = Type; this.Description = Description; }
internal static char GetRepresentingCharacter(TaskType type) { return(typeToCharMap[type]); }
/// <summary> /// 发送一个空的任务,指定类型 /// </summary> /// <param name="type"></param> public void SendEmptyTask(TaskType type) { TaskInfo task = new TaskInfo(type); SendTask(task); }
/// <summary>Constructs a TaskInProgressId object from given parts.</summary> /// <param name="jtIdentifier">jobTracker identifier</param> /// <param name="jobId">job number</param> /// <param name="type">the TaskType</param> /// <param name="id">the tip number</param> public TaskID(string jtIdentifier, int jobId, TaskType type, int id) : this(new JobID(jtIdentifier, jobId), type, id) { }
public void InsertTaskType(TaskType taskType) { context.TaskTypes.Add(taskType); }
public void DeleteTaskType(int taskId) { TaskType taskType = context.TaskTypes.Find(taskId); context.TaskTypes.Remove(taskType); }
protected override object this[string index] { get { #region switch (index) { case "UserID": return(UserID); case "TaskID": return(TaskID); case "TaskType": return(TaskType); case "TaskState": return(TaskState); case "TaskStar": return(TaskStar); case "TaskTargetNum": return(TaskTargetNum); case "TakeDate": return(TakeDate); case "CompleteNum": return(CompleteNum); case "CreateDate": return(CreateDate); default: throw new ArgumentException(string.Format("UserTask index[{0}] isn't exist.", index)); } #endregion } set { #region switch (index) { case "UserID": _UserID = value.ToNotNullString(); break; case "TaskID": _TaskID = value.ToInt(); break; case "TaskType": _TaskType = value.ToEnum <TaskType>(); break; case "TaskState": _TaskState = value.ToEnum <TaskState>(); break; case "TaskStar": _TaskStar = value.ToEnum <TaskStar>(); break; case "TaskTargetNum": _TaskTargetNum = value.ToNotNullString(); break; case "TakeDate": _TakeDate = value.ToDateTime(); break; case "CompleteNum": _CompleteNum = value.ToInt(); break; case "CreateDate": _CreateDate = value.ToDateTime(); break; default: throw new ArgumentException(string.Format("UserTask index[{0}] isn't exist.", index)); } #endregion } }
public void UpdateTaskType(TaskType taskType) { context.Set <TaskType>().AddOrUpdate(taskType); }
public ServerTask(TaskType taskType) { this.Type = taskType; this.Id = lastId++; }
public static List <Pirate> PiratesWithTask(TaskType t) => (from tuple in Main.tasks.Where(pair => pair.Value.Item1 == t) select game.GetMyPirateById(tuple.Key)).ToList();
public BeingTask(TaskType type) { }
public Task(TaskType taskType) { type = taskType; }
public void Load(int address, ushort data, TaskType task, bool extendedMemoryReference) { // nothing }
private void btnAdd_Click(object sender, EventArgs e) { //Typ des Tasks herausfinden TaskType type = TaskType.Broadcast; if (radioBtnBroadcast.Checked) { type = TaskType.Broadcast; } else if (radioBtnChatMessage.Checked) { type = TaskType.ChatMessage; } else if (radioBtnCommand.Checked) { type = TaskType.Command; } else if (radioBtnRestart.Checked) { type = TaskType.Restart; } //Zeitintervall des Tasks herausfinden Interval interval = Interval.Minutes; DateTime time = new DateTime(); if (radioBtnInterval.Checked) { interval = Interval.Minutes; time = new DateTime(1, 1, 1, 0, (int)numericUpDownMinutes.Value, 0, DateTimeKind.Unspecified); } else if (radioBtnMinuteofHour.Checked) { interval = Interval.MinuteOfHour; time = dateTimeMinuteOfHour.Value; } else if (radioBtnTimeOfDay.Checked) { interval = Interval.TimeOfDay; time = dateTimeTimeOfDay.Value; } //Id des Tasks festlegen int id; if (Helper.Instance.loadedServer.Tasks.Count == 0) { id = 0; } else { id = Helper.Instance.loadedServer.Tasks[Helper.Instance.loadedServer.Tasks.Count - 1].Id + 1; } if (type != TaskType.Restart) { Task = new ServerTask(id, type, textBoxName.Text, textBoxCommand.Text, interval, time); } else { Task = new ServerTask(id, type, textBoxName.Text, interval, time); Task.DelaySaveWorld = (int)numericUpDownRestartSavePause.Value; Task.UpdateCheck = checkBoxRestartUpdate.Checked; } Task.Enabled = true; Close(); }
public Task(GameObject object_, TaskType type_) { taskObject = object_; type = type_; }
/// <summary> /// Features: x1, x2vBuff(sparce vector), x3. /// y = 10x1 + 10x2vBuff + 30x3 + e. /// Within xBuff feature 2nd slot will be sparse most of the time. /// 2nd slot of xBuff has the least importance: Evaluation metrics do not change a lot when this slot is permuted. /// x3 has the biggest importance. /// </summary> private IDataView GetSparseDataset(TaskType task = TaskType.Regression, int numberOfInstances = 1000) { // Setup synthetic dataset. var rand = new Random(10); float[] yArray = new float[numberOfInstances], x1Array = new float[numberOfInstances], x3Array = new float[numberOfInstances]; VBuffer <float>[] vbArray = new VBuffer <float> [numberOfInstances]; for (var i = 0; i < numberOfInstances; i++) { var x1 = rand.Next(1000); x1Array[i] = x1; var x3Important = rand.Next(10000); x3Array[i] = x3Important; VBuffer <float> vb; if (i % 10 != 0) { vb = new VBuffer <float>(4, 3, new float[] { rand.Next(1000), rand.Next(1000), rand.Next(1000) }, new int[] { 0, 2, 3 }); } else { vb = new VBuffer <float>(4, 4, new float[] { rand.Next(1000), rand.Next(1000), rand.Next(1000), rand.Next(1000) }, new int[] { 0, 1, 2, 3 }); } vbArray[i] = vb; float vbSum = 0; foreach (var vbValue in vb.DenseValues()) { vbSum += vbValue * 10; } var noise = rand.Next(50); yArray[i] = 10 * x1 + vbSum + 20 * x3Important + noise; } // If binary classification, modify the labels if (task == TaskType.BinaryClassification || task == TaskType.MulticlassClassification) { GetBinaryClassificationLabels(yArray); } else if (task == TaskType.Ranking) { GetRankingLabels(yArray); } // Create data view. var bldr = new ArrayDataViewBuilder(Env); bldr.AddColumn("X1", NumberDataViewType.Single, x1Array); bldr.AddColumn("X2VBuffer", NumberDataViewType.Single, vbArray); bldr.AddColumn("X3Important", NumberDataViewType.Single, x3Array); bldr.AddColumn("Label", NumberDataViewType.Single, yArray); if (task == TaskType.Ranking) { bldr.AddColumn("GroupId", NumberDataViewType.UInt32, CreateGroupIds(yArray.Length)); } var srcDV = bldr.GetDataView(); var pipeline = ML.Transforms.Concatenate("Features", "X1", "X2VBuffer", "X3Important") .Append(ML.Transforms.Normalize("Features")); if (task == TaskType.BinaryClassification) { return(pipeline.Append(ML.Transforms.Conversion.ConvertType("Label", outputKind: DataKind.Boolean)) .Fit(srcDV).Transform(srcDV)); } else if (task == TaskType.MulticlassClassification) { return(pipeline.Append(ML.Transforms.Conversion.MapValueToKey("Label")) .Fit(srcDV).Transform(srcDV)); } else if (task == TaskType.Ranking) { return(pipeline.Append(ML.Transforms.Conversion.MapValueToKey("GroupId")) .Fit(srcDV).Transform(srcDV)); } return(pipeline.Fit(srcDV).Transform(srcDV)); }
private Task[] _tasks; // tasks to be continued from #endregion #region Constructor /// <summary> /// Create the test given the parameters /// </summary> public TaskContinueWithAllAnyTest(TestParameters parameters) { _api = parameters.Api; _taskType = parameters.TaskType; _tcOption = parameters.ContinuationOptions; // set up the TaskScheduler under which the contination will be scheduled _tm = TaskScheduler.Default; // create a new cancellation token for each test _cancellationToken = parameters.WithCancellation ? CancellationToken.None : new CancellationToken(); _taskInfos = parameters.AllTaskInfos; _tasks = new Task[parameters.AllTaskInfos.Length]; }