Example #1
0
        public ChatController(MyPlannerContext context)
        {
            _context = context;
            //UsersController.logged_user = _context.User.FirstOrDefault(m => m.username == "bianca_alexandra");
            conv_model = new ConversationViewModel();
            var options = new PusherOptions
            {
                Cluster   = "eu",
                Encrypted = true
            };

            pusher = new Pusher(
                "989960",
                "8aca8df20d212d21054b",
                "0f381668084a9cffe7f5",
                options);
        }
Example #2
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new MyPlannerContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <MyPlannerContext> >()))
            {
                // Look for any movies.
                if (context.MyTask.Any())
                {
                    return;   // DB has been seeded
                }

                context.MyTask.AddRange(
                    new MyTask
                {
                    Description = "Add some test data",
                    Due_Date    = DateTime.Now,
                    Project     = "MVC Project",
                    Owner       = "me",
                    Asignee     = "also me",
                    Status      = Models.MyTask.StatusType.InProgress,
                    Review      = "Very well"
                },

                    new MyTask
                {
                    Description = "Add some more test data",
                    Due_Date    = DateTime.Now,
                    Project     = "MVC Project",
                    Owner       = "not me this time",
                    Asignee     = "still not me",
                    Status      = Models.MyTask.StatusType.InProgress
                }

                    );
                context.SaveChanges();
            }
        }
Example #3
0
 public UsersController(MyPlannerContext context)
 {
     _context = context;
 }
Example #4
0
 public MyTasksController(MyPlannerContext context)
 {
     _context = context;
 }
Example #5
0
        public void BackPropagation(float b0_t0, float b1_t0, float w0_0_t0, float w0_1_t0, float w0_2_t0, float w0_3_t0, float w1_1_t0, float actual_price, string location, MyPlannerContext _context, int weights_id, int weights_location_id, MyTask.TagType tag)
        {
            float suggested_price = this.SuggestedPrice(b0_t0, b1_t0, w0_0_t0, w0_1_t0, w0_2_t0, w0_3_t0, w1_1_t0);
            float b0_t1           = b0_t0;   //updated biases
            float b1_t1           = b1_t0;
            float w0_0_t1         = w0_0_t0; //updated weights;
            float w0_1_t1         = w0_1_t0;
            float w0_2_t1         = w0_2_t0;
            float w0_3_t1         = w0_3_t0;
            float w1_1_t1         = w1_1_t0;
            int   n = 0;
            float temp_correction_b0 = 0;

            actual_price = actual_price / Duration;
            //Derivative of cost with respect to weights for second layer
            if (w1_1_t0 * a1 + b1_t0 > 0)
            {
                w1_1_t1 -= (learning_rate * 2 * (w1_1_t0 * a1 + b1_t0 - actual_price) * a1);
            }
            // Derivative of cost with respect to biases for second layer
            if (w1_1_t0 * a1 + b1_t0 > 0)
            {
                b1_t1 -= (learning_rate * 2 * (w1_1_t0 * a1 + b1_t0 - actual_price));
            }
            //Derivative of cost with respect to weights for first layer
            if (w0_0_t0 * x1 + b0_t0 > 0)
            {
                float correction = (learning_rate * 2 * (w0_0_t0 * x0 + b0_t0 - ((actual_price - b1_t0) / w1_1_t0) * x0 * w1_1_t0));
                w0_0_t1 -= correction;
            }

            if (w0_1_t0 * x1 + b0_t0 > 0)
            {
                float correction = (learning_rate * 2 * ((w0_1_t0 * x1 + b0_t0 - (actual_price - b1_t0) / w1_1_t0) * x1 * w1_1_t0));
                w0_1_t1 -= correction;
            }

            if (w0_2_t0 * x2 + b0_t0 > 0)
            {
                float correction = (learning_rate * 2 * ((w0_2_t0 * x2 + b0_t0 - (actual_price - b1_t0) / w1_1_t0) * x2 * w1_1_t0));
                w0_2_t1 -= correction;
            }

            if (w0_3_t0 * x3 + b0_t0 > 0)
            {
                float correction = (learning_rate * 2 * ((w0_3_t0 * x3 + b0_t0 - (actual_price - b1_t0) / w1_1_t0) * x3 * w1_1_t0));
                w0_3_t1 -= correction;
            }

            // Derivative of cost with respect to biases for first layer
            if (w0_0_t0 * x0 + b0_t0 > 0)
            {
                temp_correction_b0 -= (learning_rate * 2 * (w0_0_t0 * x1 + b0_t0 - (actual_price - b1_t0) / w1_1_t0));
                n += 1;
            }
            if (w0_1_t0 * x1 + b0_t0 > 0)
            {
                temp_correction_b0 -= (learning_rate * 2 * (w0_1_t0 * x1 + b0_t0 - (actual_price - b1_t0) / w1_1_t0));
                n += 1;
            }
            if (w0_2_t0 * x2 + b0_t0 > 0)
            {
                temp_correction_b0 -= (learning_rate * 2 * (w0_2_t0 * x2 + b0_t0 - (actual_price - b1_t0) / w1_1_t0));
                n += 1;
            }
            if (w0_3_t0 * x3 + b0_t0 > 0)
            {
                temp_correction_b0 -= (learning_rate * 2 * (w0_3_t0 * x3 + b0_t0 - (actual_price - b1_t0) / w1_1_t0));
                n += 1;
            }
            b0_t1 += temp_correction_b0 / n;

            Weights         weights_t1          = new Weights(weights_id + 1, w0_0_t1, w0_1_t1, w0_2_t1, w0_3_t1, b0_t1, tag);
            LocationWeights location_weights_t1 = new LocationWeights(weights_location_id + 1, w1_1_t1, b1_t1, location, tag);

            _context.Add(weights_t1);
            _context.Add(location_weights_t1);
        }
Example #6
0
 public UsersController(MyPlannerContext?context, IUserRepository repository = null)
 {
     _context    = context;
     _repository = repository;
     logged_user = new User();
 }