Skip to content

Commit

Permalink
Fine-tuning of the model
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk committed Nov 12, 2024
1 parent ba21be4 commit 176706a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
46 changes: 26 additions & 20 deletions keep-ui/app/ai/ai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,32 +81,38 @@ export default function Ai() {
refetchAIStats();
}}
/>
{/* <p>Value: {setting.value}</p>
<input
type="range"
id={`slider-${index}`}
name={`slider-${index}`}
// min={setting.min}
// max={setting.max}
value={setting.value}
// onChange={(e) => {
// const newValue = parseFloat(e.target.value);
// setting.value = newValue;
// updateAISettings(algorithm_config.algorithm_id, algorithm_config);
// refetchAIStats();
// }}
className="mt-2 w-full"
/> */}
</div>
) : null}
{setting.type === "int" ? (
<div>
<p>Value: {setting.value}</p>
<input
type="range"
className=""
step={1}
min={setting.min}
max={setting.max}
// value={setting.value}
onChange={(e) => {
const newValue = parseFloat(e.target.value);
setting.value = newValue;
updateAISettings(
algorithm_config.algorithm_id,
algorithm_config
);
refetchAIStats();
}}
/>
</div>
) : null}
</div>
))}
<h4 className="text-md font-medium mt-4">Execution logs:</h4>
<pre className="text-sm bg-gray-100 p-2 rounded">
{algorithm_config.feedback_log
? algorithm_config.feedback_log
<pre className="text-sm bg-gray-100 p-2 rounded break-words whitespace-pre-wrap">
{algorithm_config.feedback_logs
? algorithm_config.feedback_logs
: "Algorithm not executed yet."}
</pre>
</pre>
</Card>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/ai/model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface AIConfig {
algorithm_id: string;
settings: any;
feedback_log: string;
feedback_logs: string;
algorithm: {
name: string;
description: string;
Expand Down
1 change: 1 addition & 0 deletions keep/api/core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4390,6 +4390,7 @@ def update_extrnal_ai_settings(tenant_id: str, ai_settings: ExternalAIConfigAndM
ExternalAIConfigAndMetadata.id == ai_settings.id,
).first()
setting.settings = json.dumps(ai_settings.settings)
setting.feedback_logs = ai_settings.feedback_logs
session.add(setting)
session.commit()
return setting
2 changes: 2 additions & 0 deletions keep/api/models/db/ai_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def unique_id(self):
config_default=json.dumps(
[
{"min": 0.3, "max": 0.99, "value": 0.8, "type": "float", "name": "Correlation Threshold", "description": "The minimum correlation value to consider two alerts belonging to an ancident."},
{"min": 0.3, "max": 0.99, "value": 0.8, "type": "float", "name": "Model Accuracy Threshold", "description": "The trained model accuracy will be evaluated using cross-validation. If the accuracy is below this threshold, the model will be retrained."},
{"min": 2, "max": 20, "value": 10, "type": "int", "name": "Train Epochs", "description": "The amount of epochs to train the model for. The less the better to avoid over-fitting."},
{"value": True, "type": "bool", "name": "Enabled", "description": "Enable or disable the algorithm."},
]
)
Expand Down

0 comments on commit 176706a

Please sign in to comment.