Exemple #1
0
        public override void Train(
            List <Info> data,
            int numbEpochs,
            float learningRate,
            LearningType learningType,
            bool dataShuffleAfterEachEpoch,
            LogLevel loglevel = LogLevel.Information)
        {
            this.logLevel = loglevel;

            Log("Training start", LogLevel.Information);

            if (ValidateData(data))
            {
                for (int epochIndex = 0; epochIndex < numbEpochs; epochIndex++)
                {
                    Log(string.Format("Epoch: {0}", epochIndex), LogLevel.Information);

                    switch (learningType)
                    {
                    case LearningType.BackPropagation:
                        //BackPropagation.NetUpdate(this, data);
                        break;
                    }

                    if (dataShuffleAfterEachEpoch && (epochIndex < numbEpochs - 1))
                    {
                        data = this.ShuffleData(data);
                    }
                }

                Log("Training complete", LogLevel.Information);
            }
        }
Exemple #2
0
 public abstract void Train(
     List <Info> data,
     int numbEpochs,
     float learningRate,
     LearningType learningType,
     bool dataShuffleAfterEachEpoch,
     LogLevel logLevel);
Exemple #3
0
        public Layer(int neuronCount, Neuron.ActivationType neuronType, LearningType learnMethod)
        {
            Neurons        = new Neuron[neuronCount];
            NeuronType     = neuronType;
            LearningMethod = learnMethod;

            InitializeNeurons();
        }
Exemple #4
0
 public Student(string fullName, Sex sex, string group, double avgMark, LearningType lt, double income, FamilyType family)
 {
     this.FullName           = fullName;
     this.Sex                = sex;
     this.Group              = group;
     this.AvgMark            = avgMark;
     this.LearningType       = lt;
     this.IncomePerFamMember = income;
     this.FamilyType         = family;
 }
 public AbstractResultsController(
     IEnumerable <ISearchResultsRouteStrategy> resultRouteStrategies,
     ILookupApiService lookupApiService,
     string resultsTemplate,
     LearningType searchType)
 {
     _lookupApiService      = lookupApiService;
     _resultsTemplate       = resultsTemplate;
     _searchType            = searchType;
     _resultRouteStrategies = resultRouteStrategies;
 }
Exemple #6
0
        // POST: odata/LearningTypes
        public IHttpActionResult Post(LearningType learningType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LearningTypes.Add(learningType);
            db.SaveChanges();

            return(Created(learningType));
        }
Exemple #7
0
        // DELETE: odata/LearningTypes(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            LearningType learningType = db.LearningTypes.Find(key);

            if (learningType == null)
            {
                return(NotFound());
            }

            db.LearningTypes.Remove(learningType);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #8
0
        public LearningTypeModel ConverToTypeModel(LearningType model)
        {
            LearningTypeModel vmodel = new LearningTypeModel();

            vmodel.Name       = model.Name;
            vmodel.Desc       = model.Desc;
            vmodel.ParentId   = model.ParentId;
            vmodel.ParentName = GetTypeAttr(model.ParentId);
            vmodel.CreateDate = model.CreateDate;
            vmodel.Id         = model.Id;
            vmodel.ImgUrl     = model.ImgUrl;
            vmodel.LinkUrl    = model.LinkUrl;

            return(vmodel);
        }
Exemple #9
0
        public IActionResult Index([FromForm] BasicSearchModel searchModel, LearningType searchType)
        {
            var model = new HomeViewModel();

            ValidateSearch(searchModel, model);

            if (model.ValidationErrors.Any())
            {
                return(RedirectToAction("Index", model));
            }

            var routeStrategy = _resultRouteStrategies.SingleOrDefault(r => r.SearchType == searchType);

            if (routeStrategy != null)
            {
                return(RedirectToAction(routeStrategy.Action, routeStrategy.Controller, searchModel));
            }

            return(RedirectToAction("Index", searchModel));
        }
Exemple #10
0
        /// <param name="Pading">空格</param>
        /// <param name="DirId">父路径ID</param>
        /// <param name="datatable">返回的datatable</param>
        /// <param name="deep">树形的深度</param>
        private void LoopToList(string pading, int id, List <LearningType> datatable, int deep, List <LearningType> tree)
        {
            var list = datatable.FindAll(p => p.ParentId == id);

            foreach (LearningType row in list)
            {
                string strPading = "";
                for (int j = 0; j < deep; j++)
                {
                    strPading += " "; //用全角的空格
                }
                //添加节点
                LearningType temp = row;
                temp.Name = strPading + "|--" + temp.Name;
                tree.Add(temp);

                //递归调用addOtherDll函数,在函数中把deep加1
                LoopToList(strPading, row.Id, datatable, deep + 1, tree);
            }
        }
Exemple #11
0
        public ServiceResult AddType(LearningTypeModel model)
        {
            ServiceResult result = new ServiceResult();

            LearningType info = new LearningType();

            info.CompanyId    = model.CompanyId;
            info.CreateDate   = DateTime.Now;
            info.CreateUserId = model.UserId;
            info.Desc         = model.Desc;
            info.ImgUrl       = model.ImgUrl;
            info.LastDate     = DateTime.Now;
            info.LastUserId   = model.UserId;
            info.Name         = model.Name;
            info.ParentId     = model.ParentId;
            info.LinkUrl      = model.LinkUrl;

            var id = _learningType.Insert(info);

            return(result);
        }
Exemple #12
0
        public IHttpActionResult Patch([FromODataUri] int key, Delta <LearningType> patch)
        {
            Validate(patch.GetInstance());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            LearningType learningType = db.LearningTypes.Find(key);

            if (learningType == null)
            {
                return(NotFound());
            }

            patch.Patch(learningType);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LearningTypeExists(key))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Updated(learningType));
        }
Exemple #13
0
 public LearningPage(LearningType type)
 {
     InitializeComponent();
     LearningContent.Children.Clear();
     LearningContent.Children.Add(type.View);
 }