Exemple #1
0
        public WorkshopData LoadAddress(WorkshopData account)
        {
            DbContext.Entry(account).Reference(p => p.Address).Load();
            DbContext.Entry(account.Address).Reference(p => p.City).Load();

            return(account);
        }
Exemple #2
0
 public CareerFairGUI()
 {
     InitializeComponent();
     prepData           = new WorkshopPrep();
     currentData        = new WorkshopData();
     districtChangeList = new List <District>();
     fileIO             = new WorkshopIO();
 }
Exemple #3
0
    public void Open(IEnumerable <FullModDetails> availableMods)
    {
        workshopData = WorkshopData.Load();

        mods = availableMods.ToList();

        UpdateAvailableModsList();
        UpdateLayout();

        uploadDialog.PopupCenteredShrink();
        UpdateUploadButtonStatus();
    }
Exemple #4
0
            private static PredictionModel <WorkshopData, ClusterPrediction> Train()
            {
                var pipeline = new LearningPipeline();

                //building dataset of WorkshopData
                List <WorkshopData> data = new List <WorkshopData>();
                string line;

                using (var reader = File.OpenText(_dataPath))
                {
                    while ((line = reader.ReadLine()) != null)
                    {
                        string        convertedData       = line;
                        List <string> WorkshopFeaturesSet = convertedData.Split(',').ToList();
                        WorkshopData  wd = new WorkshopData
                        {
                            price    = float.Parse(WorkshopFeaturesSet[0]),
                            duration = float.Parse(WorkshopFeaturesSet[1]),
                            day      = float.Parse(WorkshopFeaturesSet[2]),
                            time     = float.Parse(WorkshopFeaturesSet[3]),
                            teacher  = float.Parse(WorkshopFeaturesSet[4])
                        };
                        data.Add(wd);
                    }
                }

                var collection = CollectionDataSource.Create(data);

                pipeline.Add(collection);
                pipeline.Add(new ColumnConcatenator(
                                 "Features",
                                 "price",
                                 "duration",
                                 "day",
                                 "time",
                                 "teacher")
                             );

                pipeline.Add(new KMeansPlusPlusClusterer()
                {
                    K = 3
                });


                var model = pipeline.Train <WorkshopData, ClusterPrediction>();

                return(model);
            }
 private void PublishWorkshopEvent <T>(WorkshopData workshop)
     where T : WorkshopEvent, new()
 {
     eventBus.Publish(new T()
     {
         SourceId = workshop.ID,
         Owner    = new Owner
         {
             //use this values from Identity
             Phone = "101",           //workshop.OwnerName,
             Email = "*****@*****.**" //workshop.OwnerEmail,
         },
         Name         = workshop.Name,
         Description  = workshop.Description,
         Location     = workshop.Location.ToString(),
         Slug         = workshop.Slug,
         RegisterDate = workshop.RegisterDate
     });
 }
Exemple #6
0
        public void WorkshopMapper()
        {
            var workshopData = new WorkshopData
            {
                Name                  = "cto alexa",
                Unp                   = 123456789,
                AvgRate               = 0,
                PayHour               = 23.5000M,
                LocationID            = Guid.Empty,
                Location              = null,
                WorkshopAutobrands    = null,
                WorkshopCategories    = null,
                WorkshopWeekTimetable = null,
                RegisterDate          = DateTime.Now,
                Slug                  = "test"
            };

            var result = Mapper.Map <WorkshopViewModel>(workshopData);

            Assert.AreEqual("cto alexa", workshopData.Name);
        }
Exemple #7
0
 public WorkshopData LoadAnchors(WorkshopData account)
 {
     DbContext.Entry(account).Collection(p => p.Anchors).Load();
     return(account);
 }
Exemple #8
0
 public void Update(WorkshopData @new, WorkshopData source)
 {
     DbContext.Entry(source).State = Microsoft.EntityFrameworkCore.EntityState.Detached;
     DbContext.Update(@new);
 }
Exemple #9
0
 public Guid Add(WorkshopData account)
 {
     DbContext.Add(account);
     return(account.ID);
 }
Exemple #10
0
        public JsonResult Related(int?id)
        {
            //Getting The related worksops
            var workshop = _context.Workshop.Find(id);
            //(cach) Check if allready have previos prediction
            var clusterResult = _context.ClusterResulter
                                .Where(b => b.WokshopId == id)
                                .FirstOrDefault();

            IQueryable <ClusterResulter> crs;


            if (clusterResult != null)
            {
                //create list of recomandation for join Recomandation

                crs = _context.ClusterResulter.Where(b => b.ClusterRes == clusterResult.ClusterRes);
            }
            else
            {
                //Create Dataset file from all the Workshops Using WorkshopService
                WorkshopClusterService workshopService = new WorkshopClusterService(_context);
                workshopService.PreproccessingAllWorkshops();

                //Clear DB before retrain
                var rows = from o in _context.ClusterResulter
                           select o;
                foreach (var row in rows)
                {
                    _context.ClusterResulter.Remove(row);
                }
                _context.SaveChanges();
                //_context.ClusterResulter.RemoveRange();
                //_context.SaveChanges();

                //Train Modal
                WorkshopClustering bc = new WorkshopClustering();


                //Get all Workshops
                var workshops = _context.Workshop.ToList();
                //Predict for each Workshop and create DB ClusterResulter
                foreach (Workshop ws in workshops)
                {
                    //Preparing ClusterResulter for DB
                    ClusterResulter cr = new ClusterResulter();

                    //ADding WorkshopID to ClusterResulter
                    cr.WokshopId = ws.WorkshopId;

                    // Prepare WorkshopItem as WorkshopData (featuresSet)
                    WorkshopData wd = workshopService.CreateDataObject(ws);

                    //Train & Predict
                    ClusterPrediction cp = bc.Predict(wd);
                    cr.ClusterRes = Convert.ToInt32(cp.PredictedClusterId);

                    //Save Result in DB
                    _context.ClusterResulter.Add(cr);
                }
                _context.SaveChanges();

                //Get Book Prediction Class
                ClusterPrediction cp_final = bc.Predict(workshopService.CreateDataObject(workshop));
                int predId = Convert.ToInt32(cp_final.PredictedClusterId);

                //Get relevant predictions
                crs = _context.ClusterResulter
                      .Where(b => b.ClusterRes == predId);
            }

            var recomended = from bk in _context.Workshop
                             join cr in crs on bk.WorkshopId equals cr.WokshopId
                             where cr.WokshopId != id
                             select new
            {
                Id       = bk.WorkshopId,
                Name     = bk.WorkshopName,
                Price    = bk.Price,
                Category = bk.Category,
                Result   = cr.ClusterRes
            };

            return(Json(recomended));
        }
Exemple #11
0
            public ClusterPrediction Predict(WorkshopData wsData)
            {
                var model = Train();

                return(model.Predict(wsData));
            }