Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Semantic Router
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
aurelio-labs
Semantic Router
Commits
029f41f0
Unverified
Commit
029f41f0
authored
1 year ago
by
James Briggs
Browse files
Options
Downloads
Patches
Plain Diff
tweaks
parent
01162617
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
decision_layer/decision_layer.py
+6
-8
6 additions, 8 deletions
decision_layer/decision_layer.py
with
6 additions
and
8 deletions
decision_layer/decision_layer.py
+
6
−
8
View file @
029f41f0
...
...
@@ -15,15 +15,13 @@ class DecisionLayer:
for
decision
in
decisions
:
self
.
_add_decision
(
decision
=
decision
)
def
__call__
(
self
,
text
:
str
):
def
__call__
(
self
,
text
:
str
,
_tan
:
bool
=
True
,
_threshold
:
float
=
0.5
):
results
=
self
.
_query
(
text
)
decision
=
self
.
simple_categorize
(
results
)
decision
=
self
.
_semantic_classify
(
results
,
apply_tan
=
_tan
,
threshold
=
_threshold
)
# return decision
raise
NotImplementedError
(
"
To implement decision logic based on scores
"
)
return
decision
def
add
(
self
,
decision
:
Decision
,
dimensiona
):
def
add
(
self
,
decision
:
Decision
):
self
.
_add_decision
(
devision
=
decision
)
def
_add_decision
(
self
,
decision
:
Decision
):
...
...
@@ -60,8 +58,8 @@ class DecisionLayer:
{
"
decision
"
:
d
,
"
score
"
:
s
.
item
()}
for
d
,
s
in
zip
(
decisions
,
scores
)
]
def
simple
_classify
(
self
,
query_results
:
dict
,
apply_tan
:
bool
=
True
):
"""
Given some text, categori
s
es
it based on the scores from _query
.
"""
def
_semantic
_classify
(
self
,
query_results
:
dict
,
apply_tan
:
bool
=
True
,
threshold
:
float
=
0.5
):
"""
Given some text, categori
z
es.
"""
# apply the scoring system to the results and group by category
scores_by_category
=
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment