Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dyn 5427 confidence threshold autocomplete ml #13562

Merged
merged 12 commits into from
Nov 23, 2022
18 changes: 18 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,21 @@ public string PythonTemplateFilePath
/// </summary>
public bool EnableNodeAutoComplete { get; set; }

/// <summary>
/// This defines if user wants to hide the nodes below a specific confidenc level.
/// </summary>
public bool HideNodesBelowSpecificConfidenceLevel { get; set; }

/// <summary>
/// This defines the level of confidence related to the ML recommendation.
/// </summary>
public int MLRecommendationConfidenceLevel { get; set; }

/// <summary>
/// This defines the number of results of the ML recommendation
/// </summary>
public int MLRecommendationNumberOfResults { get; set; }

/// <summary>
/// This defines if user wants to see the enabled Dynamo Notification Center.
/// </summary>
Expand Down Expand Up @@ -736,6 +751,9 @@ public PreferenceSettings()
IsIronPythonDialogDisabled = false;
ShowTabsAndSpacesInScriptEditor = false;
EnableNodeAutoComplete = true;
HideNodesBelowSpecificConfidenceLevel = false;
MLRecommendationConfidenceLevel = 10;
MLRecommendationNumberOfResults = 5;
zeusongit marked this conversation as resolved.
Show resolved Hide resolved
EnableNotificationCenter = true;
isStaticSplashScreenEnabled = true;
DefaultPythonEngine = string.Empty;
Expand Down
36 changes: 36 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3316,6 +3316,19 @@ You can manage this in Preferences -&gt; Security.</value>
<value>Your custom settings can be imported here. Settings not exposed via Preferences panel will be applied once Dynamo and any host program restarts.</value>
<comment>Import Preferences Info.</comment>
</data>
<data name="PreferencesViewNodeAutocomplete" xml:space="preserve">
<value>Node Autocomplete</value>
<comment>Preferences | Features | Node Autocomplete</comment>
</data>
<data name="HideNodesBelowSpecificConfidenceLevel" xml:space="preserve">
<value>Hide nodes below a specified confidence level</value>
</data>
<data name="HideNodesBelowSpecificConfidenceLevelInfo" xml:space="preserve">
<value>Confidence level appears next to each recommended node and represents estimated probability that the node is a good choice. When toggled on, this setting hides recommended nodes that don’t meet the specified confidence level. You can click the Low Confidence header to show the nodes.</value>
</data>
<data name="MLRecommendationNumberOfResults" xml:space="preserve">
<value>Numbers of results</value>
</data>
<data name="ImportPreferencesText" xml:space="preserve">
<value>Import</value>
<comment>Import Preferences Text.</comment>
Expand Down
13 changes: 13 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3303,6 +3303,19 @@ You can manage this in Preferences -&gt; Security.</value>
<value>Your custom settings can be imported here. Settings not exposed via Preferences panel will be applied once Dynamo and any host program restarts.</value>
<comment>Import Preferences Info.</comment>
</data>
<data name="PreferencesViewNodeAutocomplete" xml:space="preserve">
<value>Node Autocomplete</value>
<comment>Preferences | Features | Node Autocomplete</comment>
</data>
<data name="HideNodesBelowSpecificConfidenceLevel" xml:space="preserve">
<value>Hide nodes below a specified confidence level</value>
</data>
<data name="HideNodesBelowSpecificConfidenceLevelInfo" xml:space="preserve">
<value>Confidence level appears next to each recommended node and represents estimated probability that the node is a good choice. When toggled on, this setting hides recommended nodes that don’t meet the specified confidence level. You can click the Low Confidence header to show the nodes.</value>
</data>
<data name="MLRecommendationNumberOfResults" xml:space="preserve">
<value>Numbers of results</value>
</data>
<data name="ImportPreferencesText" xml:space="preserve">
<value>Import</value>
<comment>Import Preferences Text.</comment>
Expand Down
149 changes: 114 additions & 35 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,33 +255,7 @@ public bool RunSettingsIsChecked
}
RaisePropertyChanged(nameof(RunSettingsIsChecked));
}
}

/// <summary>
/// Controls if the the Node autocomplete Machine Learning option is checked for the radio buttons
/// </summary>
public bool NodeAutocompleteMachineLearningIsChecked
{
get
{
return preferenceSettings.DefaultNodeAutocompleteSuggestion == NodeAutocompleteSuggestion.MLRecommendation;
}
set
{
if (value)
{
preferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.MLRecommendation;
nodeAutocompleteSuggestion = NodeAutocompleteSuggestion.MLRecommendation;
}
else
{
preferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;
nodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;
}
dynamoViewModel.HomeSpaceViewModel.NodeAutoCompleteSearchViewModel.ResetAutoCompleteSearchViewState();
RaisePropertyChanged(nameof(nodeAutocompleteSuggestion));
}
}
}

/// <summary>
/// Controls the IsChecked property in the Show Run Preview toogle button
Expand Down Expand Up @@ -530,9 +504,7 @@ public void AddStyle(StyleItem style)
});
RaisePropertyChanged(nameof(StyleItemsList));
}




/// <summary>
/// This flag will be in true when the Style that user is trying to add already exists (otherwise will be false - Default)
/// </summary>
Expand Down Expand Up @@ -837,6 +809,24 @@ public bool ShowWhitespaceIsChecked
}
}

/// <summary>
/// Controls the IsChecked property in the "Notification Center" toogle button
/// </summary>
public bool NotificationCenterIsChecked
{
get
{
return preferenceSettings.EnableNotificationCenter;
}
set
{
preferenceSettings.EnableNotificationCenter = value;
RaisePropertyChanged(nameof(NotificationCenterIsChecked));
}
}

#region [ Node Autocomplete ]

/// <summary>
/// Controls the IsChecked property in the "Node autocomplete" toogle button
/// </summary>
Expand All @@ -850,25 +840,114 @@ public bool NodeAutocompleteIsChecked
{
preferenceSettings.EnableNodeAutoComplete = value;
RaisePropertyChanged(nameof(NodeAutocompleteIsChecked));
RaisePropertyChanged(nameof(EnableHideNodesToggle));
RaisePropertyChanged(nameof(EnableConfidenceLevelSlider));
}
}

/// <summary>
/// Controls the IsChecked property in the "Notification Center" toogle button
/// Controls if the the Node autocomplete Machine Learning option is checked for the radio buttons
/// </summary>
public bool NotificationCenterIsChecked
public bool NodeAutocompleteMachineLearningIsChecked
{
get
{
return preferenceSettings.EnableNotificationCenter;
return preferenceSettings.DefaultNodeAutocompleteSuggestion == NodeAutocompleteSuggestion.MLRecommendation;
}
set
{
preferenceSettings.EnableNotificationCenter = value;
RaisePropertyChanged(nameof(NotificationCenterIsChecked));
if (value)
{
preferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.MLRecommendation;
nodeAutocompleteSuggestion = NodeAutocompleteSuggestion.MLRecommendation;
}
else
{
preferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;
nodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;
}

dynamoViewModel.HomeSpaceViewModel.NodeAutoCompleteSearchViewModel.ResetAutoCompleteSearchViewState();
RaisePropertyChanged(nameof(nodeAutocompleteSuggestion));
RaisePropertyChanged(nameof(NodeAutocompleteMachineLearningIsChecked));
RaisePropertyChanged(nameof(EnableHideNodesToggle));
RaisePropertyChanged(nameof(EnableConfidenceLevelSlider));
}
}

/// <summary>
/// Contains the numbers of result of the ML recommendation
/// </summary>
public int MLRecommendationNumberOfResults
{
get
{
return preferenceSettings.MLRecommendationNumberOfResults;
}
set
{
preferenceSettings.MLRecommendationNumberOfResults = value;
RaisePropertyChanged(nameof(MLRecommendationNumberOfResults));
}
}

/// <summary>
/// Controls the IsChecked property in the "Hide nodes below a specific confidence level" toogle button
/// </summary>
public bool HideNodesBelowSpecificConfidenceLevelIsChecked
{
get
{
return preferenceSettings.HideNodesBelowSpecificConfidenceLevel;
}
set
{
preferenceSettings.HideNodesBelowSpecificConfidenceLevel = value;
RaisePropertyChanged(nameof(HideNodesBelowSpecificConfidenceLevelIsChecked));
RaisePropertyChanged(nameof(EnableConfidenceLevelSlider));
}
}

/// <summary>
/// Contains the confidence level of a ML recommendation
/// </summary>
public int MLRecommendationConfidenceLevel
{
get
{
return preferenceSettings.MLRecommendationConfidenceLevel;
}
set
{
preferenceSettings.MLRecommendationConfidenceLevel = value;
RaisePropertyChanged(nameof(MLRecommendationConfidenceLevel));
}
}

/// <summary>
/// If the user can click on the Hide Nodes toggle
/// </summary>
public bool EnableHideNodesToggle
{
get
{
return NodeAutocompleteIsChecked && NodeAutocompleteMachineLearningIsChecked;
}
}

/// <summary>
/// If the user can click on the confidence level Slider
/// </summary>
public bool EnableConfidenceLevelSlider
{
get
{
return NodeAutocompleteIsChecked && NodeAutocompleteMachineLearningIsChecked && HideNodesBelowSpecificConfidenceLevelIsChecked;
}
}

#endregion

/// <summary>
/// Controls the IsChecked property in the "Enable T-spline nodes" toogle button
/// </summary>
Expand Down
Loading