Skip to content

evaluate and training new features #794

Open
BarbosaJackson wants to merge 11 commits into
masterfrom
feature/evaluates
Open

evaluate and training new features #794
BarbosaJackson wants to merge 11 commits into
masterfrom
feature/evaluates

Conversation

@BarbosaJackson

Copy link
Copy Markdown

No description provided.

)

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

@elitonzky elitonzky May 25, 2023

Copy link
Copy Markdown

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


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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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']

Copy link
Copy Markdown

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

return Response(response) # pragma: no cover


@action(

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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"))

@elitonzky elitonzky May 26, 2023

Copy link
Copy Markdown

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)

Copy link
Copy Markdown

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])

Copy link
Copy Markdown

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]
                    )

Comment thread bothub/utils.py
]


def levenshtein_distance(str1, str2):

Copy link
Copy Markdown

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]

@elitonzky elitonzky left a comment

Copy link
Copy Markdown

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