evaluate and training new features #794
Conversation
| ) | ||
|
|
||
| type = filters.CharFilter( | ||
| field_name="type", |
There was a problem hiding this comment.
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) | ||
|
|
There was a problem hiding this comment.
this line contains whitespace:
for more details: https://www.flake8rules.com/rules/W293.html
|
|
||
| def get_accuracy(self, obj): | ||
| return obj.intent_results.accuracy | ||
|
|
There was a problem hiding this comment.
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'] | ||
|
|
There was a problem hiding this comment.
this line contains whitespace:
for more details: https://www.flake8rules.com/rules/W293.html
| return Response(response) # pragma: no cover | ||
|
|
||
|
|
||
| @action( |
There was a problem hiding this comment.
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 | ||
|
|
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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]
)
| ] | ||
|
|
||
|
|
||
| def levenshtein_distance(str1, str2): |
There was a problem hiding this comment.
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]
No description provided.