public DataExportView(ActivityRecommender activityRecommender, Persona persona, LayoutStack layoutStack)
        {
            this.SetTitle("Export Your Data");

            this.persona = persona;


            this.exportButton          = new Button();
            this.exportButton.Clicked += ExportButton_Clicked;

            this.activityRecommender = activityRecommender;
            this.layoutStack         = layoutStack;

            this.SetupView();
            this.persona.NameChanged += Persona_NameChanged;
        }
        public EngineTesterView(ActivityRecommender recommender, LayoutStack layoutStack)
        {
            this.activityRecommender = recommender;
            this.layoutStack         = layoutStack;

            this.SetTitle("For Developers: Back-Testing");

            TextblockLayout explanationLayout = new TextblockLayout("This feature is incredibly slow (may take several minutes) and mostly intended for developers. "
                                                                    + "It does back-testing using all of your past data and computes the overall accuracy of the predictions that ActivityRecommender would make if it "
                                                                    + "were given all of the same data again (the intent is that you will change something about ActivityRecommender and then run this to see if "
                                                                    + "it made ActivityRecommender's predictions more accurate). Do you want to continue?");

            Button confirmButton = new Button();

            confirmButton.Text     = "Compute Overall Accuracy";
            confirmButton.Clicked += ConfirmButton_Clicked;

            LayoutChoice_Set gridLayout = new Vertical_GridLayout_Builder().Uniform()
                                          .AddLayout(explanationLayout)
                                          .AddLayout(new ButtonLayout(confirmButton))
                                          .Build();

            this.SetContent(gridLayout);
        }
        public ExperimentInitializationLayout(LayoutStack layoutStack, ActivityRecommender activityRecommender, ActivityDatabase activityDatabase, ProtoActivity_Database protoActivity_database, Engine engine, int numActivitiesThatMayBeRequestedDirectly)
        {
            this.SetTitle("Efficiency Experiment");
            this.activityRecommender = activityRecommender;

            Button okbutton = new Button();

            this.okButtonLayout = new ButtonLayout(okbutton, "Next");
            okbutton.Clicked   += Okbutton_Clicked;

            LayoutChoice_Set helpButton = this.make_helpButton(layoutStack);

            SuggestedMetric_Metadata experimentsStatus = activityRecommender.Test_ChooseExperimentOption();

            if (experimentsStatus.Error != "")
            {
                this.SetContent(new TextblockLayout(experimentsStatus.Error));
                return;
            }

            this.statusHolder = new ContainerLayout();
            GridLayout topGrid = new Horizontal_GridLayout_Builder()
                                 .AddLayout(helpButton)
                                 .AddLayout(new HelpButtonLayout("Browse Activities", new ActivitySearchView(activityDatabase, protoActivity_database, layoutStack), layoutStack))
                                 .Uniform()
                                 .Build();

            GridLayout_Builder childrenBuilder = new Horizontal_GridLayout_Builder().Uniform();

            for (int i = 0; i < this.numChoices; i++)
            {
                bool allowRequestingActivityDirectly = (i < numActivitiesThatMayBeRequestedDirectly);
                ExperimentOptionLayout child         = new ExperimentOptionLayout(this, activityDatabase, allowRequestingActivityDirectly, engine, layoutStack);
                this.children.Add(child);
                childrenBuilder.AddLayout(child);
                child.SuggestionDismissed += Child_SuggestionDismissed;
                child.JustifySuggestion   += Child_JustifySuggestion;
            }
            GridLayout bottomGrid = childrenBuilder.Build();

            BoundProperty_List rowHeights = new BoundProperty_List(3);

            rowHeights.BindIndices(0, 1);
            rowHeights.BindIndices(0, 2);
            rowHeights.SetPropertyScale(0, 2);
            rowHeights.SetPropertyScale(1, 1);
            rowHeights.SetPropertyScale(2, 6);

            GridLayout mainGrid = GridLayout.New(rowHeights, new BoundProperty_List(1), LayoutScore.Zero);

            mainGrid.AddLayout(topGrid);
            mainGrid.AddLayout(this.statusHolder);
            mainGrid.AddLayout(bottomGrid);

            string statusMessage = "(" + experimentsStatus.NumExperimentParticipationsRemaining + " experiment";

            if (experimentsStatus.NumExperimentParticipationsRemaining != 1)
            {
                statusMessage += "s";
            }
            statusMessage += " remaining before another ToDo must be entered!)";
            this.UpdateStatus(statusMessage);

            this.SetContent(mainGrid);
        }
Exemplo n.º 4
0
        public SuggestionsView(ActivityRecommender recommenderToInform, LayoutStack layoutStack, ActivityDatabase activityDatabase, Engine engine) : base("Get Suggestions")
        {
            this.TitleLayout.AlignVertically(TextAlignment.Center);
            this.activityDatabase = activityDatabase;
            this.engine           = engine;
            this.recommender      = recommenderToInform;

            this.layoutStack = layoutStack;

            this.messageLayout = new TextblockLayout("").AlignHorizontally(TextAlignment.Center).AlignVertically(TextAlignment.Center);

            this.requestSuggestion_layout = new RequestSuggestion_Layout(activityDatabase, true, true, false, 3, engine, layoutStack);
            this.requestSuggestion_layout.RequestSuggestion += RequestSuggestion_layout_RequestSuggestion;
            this.askWhatIsNext_layout = new TextblockLayout().AlignHorizontally(TextAlignment.Center).AlignVertically(TextAlignment.Center);

            LayoutChoice_Set helpWindow = (new HelpWindowBuilder()).AddMessage("Use this screen to ask for activity recommendations from among activities you have said that you like.")
                                          .AddMessage("By default, the recommendation will attempt to maximize your long-term happiness.")
                                          .AddMessage("The recommendation may be slightly randomized if ActivityRecommender doesn't have enough time to consider every activity within a couple seconds.")
                                          .AddMessage("If you are sure that you want an activity from a certain category, then you can enter its name into the category box, and ActivityRecommender will make sure " +
                                                      "that your suggestion will be an instance of that activity. For example, if you have previously entered an activity named Checkers and listed it as a child activity " +
                                                      "of Game, then when you ask for a Game, one possible suggestion will be Checkers.")
                                          .AddMessage("If you're looking for an activity to have a high amount of enjoyability right now, then think of what you would do if you couldn't ask ActivityRecommender for " +
                                                      "help, and type the name of that activity into the second box. If you do, then ActivityRecommender will make sure to provide a suggestion that it thinks you will like as " +
                                                      "much as it thinks you will like as much as the one you entered.")
                                          .AddMessage("Then, push one of the Suggest buttons")
                                          .AddMessage("You can request either the activity that is expected to maximize the long-term value to you, or " +
                                                      "the activity that ActivityRecommender thinks that you're most likely to do, among the activities satisfying your other criteria.")
                                          .AddMessage("Each suggestion will list an activity name, followed by the time to start the activity, an estimate of the probability that you will actually do that activity, " +
                                                      "and an estimate of the rating that you'd be expected to give to that activity.")
                                          .AddMessage("If you don't like a suggestion, press the X button next to it. The duration between when you ask for a suggestion and when you press the X is considered to " +
                                                      "be worth 0 happiness to you (unless you already recorded having done a participation during that time, in which case the duration between your latest completed participation and " +
                                                      "when you press the X is considered to be worth 0 happiness to you), so ActivityRecommender tries to avoid giving you too many suggestions that you don't take. However, if there's " +
                                                      "a certain activity that ActivityRecommender thinks would be awesome for you despite your current disinterest, then ActivityRecommender may repeat its suggestions a few times, in " +
                                                      "an effort to get you to reconsider.")
                                          .AddMessage("You can also plan out several participations in a row by pressing the Suggest button multiple times in a row.")
                                          .AddMessage("Whenever you record a participation matching the first suggestion in the list, then that suggestion will be removed.")
                                          .AddMessage("Enjoy!")
                                          .AddLayout(new CreditsButtonBuilder(layoutStack)
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2019, 8, 1), "Suggested that when the user asks for a suggestion at least as fun as a certain activity, ActivityRecommender should always suggest a different activity than the one they mentioned")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 7, 18), "Pointed out that buttons on iOS weren't visually responding to touch")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 12, 17), "Mentioned that the suggestions were sometimes more repetitive than desired")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 3, 26), "Suggested that the suggestions view could use the same descriptions as the participation entry view")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 4, 24), "Asked for the suggestions to be less repetitive again")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 4, 30), "Asked for the suggestions view to display multiple suggestions at once")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 7, 2), "Suggested shorter suggestion button text")
                                                     .Build()
                                                     )
                                          .Build();

            this.helpButton_layout         = new HelpButtonLayout(helpWindow, this.layoutStack);
            this.experimentButton          = new Button();
            this.startExperiment_layout    = new ButtonLayout(this.experimentButton, "Efficiency Experiment");
            this.experimentButton.Clicked += ExperimentButton_Clicked;
            this.bottomLayout              = new Horizontal_GridLayout_Builder().Uniform().AddLayout(this.startExperiment_layout).AddLayout(this.helpButton_layout).Build();

            Vertical_GridLayout_Builder noActivities_help_builder = new Vertical_GridLayout_Builder();

            noActivities_help_builder.AddLayout(new TextblockLayout("This screen is where you will be able to ask for suggestions of what to do."));
            noActivities_help_builder.AddLayout(
                new HelpButtonLayout("Not a calendar: no interruptions, no reminders. Exciting!",
                                     new HelpWindowBuilder()
                                     .AddMessage("ActivityRecommender doesn't offer reminders at prescheduled times because that's boring. " +
                                                 "If you're looking for a simple scheduling algorithm, you may be interested in a calendar. ActivityRecommender is more like " +
                                                 "a friend, full of cool, interesting, somewhat randomized ideas based on information about you.")
                                     .Build()
                                     ,
                                     layoutStack
                                     )
                );
            noActivities_help_builder.AddLayout(
                new HelpButtonLayout("Suggestions get better over time",
                                     new HelpWindowBuilder()
                                     .AddMessage("The more data you enter into ActivityRecommender, the better its suggestions will be.")
                                     .AddMessage("When you haven't entered much data, ActivityRecommender primarily suggests activities that resemble other " +
                                                 "activities that you like. For example, if you've mentioned that Soccer and Jogging are relevant to you and that " +
                                                 "both of them are exercise, and if you tend to like Soccer, then ActivityRecommender may also recomend Jogging to you.")
                                     .AddMessage("After you've entered a little bit of data, ActivityRecommender tends to suggest activities that you like. " +
                                                 "If you tend to enjoy playing Soccer, then ActivityRecommender will recommend that!")
                                     .AddMessage("After you've entered more data, ActivityRecommender will be able to look for trends in how happy you are after " +
                                                 "having done various activities, and incorporate that too. For example, if you like to Eat Ice Cream, but eating ice cream" +
                                                 "late at night tends to make it hard to sleep, then maybe ActivityRecommender won't suggest it late at night even if you " +
                                                 "like it.")
                                     .AddMessage("After you've entered a lot of data, ActivityRecommender will even be able to look for trends in how happy you are " +
                                                 "after suggesting various activities. If you like walking but you don't have any ideas of where to walk, then maybe " +
                                                 "ActivityRecommender will notice that suggesting Walking never works. However, if you like buying things at the store, then " +
                                                 "perhaps ActivityRecommender will suggest that instead, if that causes you to walk to the store to buy something.")
                                     .Build()
                                     ,
                                     layoutStack
                                     )
                );
            noActivities_help_builder.AddLayout(new TextblockLayout("Before you can ask for a suggestion, ActivityRecommender needs you to go back " +
                                                                    "and add some activities first. Here is a convenient button for jumping directly to the Activities screen:"));
            Button visitActivities_button = new Button();

            visitActivities_button.Text     = "Activities";
            visitActivities_button.Clicked += VisitActivities_button_Clicked;
            noActivities_help_builder.AddLayout(new ButtonLayout(visitActivities_button));

            this.noActivities_explanationLayout = noActivities_help_builder.BuildAnyLayout();

            this.UpdateSuggestions();
        }