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

evaluate and training new features #794

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Conversation

BarbosaJackson
Copy link
Collaborator

No description provided.

@@ -110,6 +110,12 @@ class Meta:
help_text=_("Filter for repository cross_validation results."),
)

type = filters.CharFilter(
field_name="type",
Copy link

@elitonzky elitonzky May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line contains trailing whitespace in:
field_name="type",
for more details: https://www.flake8rules.com/rules/W291.html

@@ -139,6 +145,9 @@ def filter_repository_version(self, queryset, name, value):

def filter_repository_cross_validation(self, queryset, name, value):
return queryset.filter(cross_validation=value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line contains whitespace:

for more details: https://www.flake8rules.com/rules/W293.html


def get_accuracy(self, obj):
return obj.intent_results.accuracy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line contains whitespace:

for more details: https://www.flake8rules.com/rules/W293.html

for j in range(i, intents[intent]['count']):
intents[intent]['distance'] += levenshtein_distance(intents[intent]['text'][i], intents[intent]['text'][j])
sum_distance += intents[intent]['distance']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line contains whitespace:

for more details: https://www.flake8rules.com/rules/W293.html

@@ -789,6 +827,47 @@ def check_can_automatic_evaluate(self, request, **kwargs):
return Response(response) # pragma: no cover


@action(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line contains two blank lines, by default we use 1 line for methods and 2 for classes.

raise APIException(
{"status_code": nlp_request.status_code}, code=nlp_request.status_code
) # pragma: no cover

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line contains whitespace:

for more details: https://www.flake8rules.com/rules/W293.html

raise APIException(e.message, code=400)
data = request.data
response = []
version_languages = RepositoryVersionLanguage.objects.filter(repository_version__pk=data.get("repository_version"))
Copy link

@elitonzky elitonzky May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is long exceeding 119 characters, you can adjust it like this:

version_languages = RepositoryVersionLanguage.objects.filter(
    repository_version__pk=data.get("repository_version")
)

if not user_authorization.can_write:
raise PermissionDenied()

examples = RepositoryExample.objects.filter(repository_version_language__repository_version__repository=repository)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is long exceeding 119 characters, you can adjust it like this:

        examples = RepositoryExample.objects.filter(
            repository_version_language__repository_version__repository=repository
        )

for intent in intents:
for i in range(0, intents[intent]['count']):
for j in range(i, intents[intent]['count']):
intents[intent]['distance'] += levenshtein_distance(intents[intent]['text'][i], intents[intent]['text'][j])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is long exceeding 119 characters, you can adjust it like this:

                for j in range(i, intents[intent]["count"]):
                    intents[intent]["distance"] += levenshtein_distance(
                        intents[intent]["text"][i], intents[intent]["text"][j]
                    )

@@ -512,3 +512,29 @@ def check_module_permission(claims, user):
"categories_list",
"repository_type",
]


def levenshtein_distance(str1, str2):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lines with blank lines after separators:
520,522,524,529,535.
Lines missing whitespace after ",":
529, 535, 536, 537, 538.
you could do it like this:

def levenshtein_distance(str1, str2):
    size_x = len(str1) + 1
    size_y = len(str2) + 1
    matrix = np.zeros((size_x, size_y))
    for x in range(size_x):
        matrix[x, 0] = x
    for y in range(size_y):
        matrix[0, y] = y

    for x in range(1, size_x):
        for y in range(1, size_y):
            if str1[x - 1] == str2[y - 1]:
                matrix[x, y] = min(
                    matrix[x - 1, y] + 1, matrix[x - 1, y - 1], matrix[x, y - 1] + 1
                )
            else:
                matrix[x, y] = min(
                    matrix[x - 1, y] + 1, matrix[x - 1, y - 1] + 1, matrix[x, y - 1] + 1
                )
    return matrix[size_x - 1, size_y - 1]

Copy link

@elitonzky elitonzky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some pending changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants