Skip to content

Instantly share code, notes, and snippets.

@Sandy4321
Sandy4321 / taxonomy.md
Created May 25, 2023 21:22 — forked from avidale/taxonomy.md
w2v-taxonomy

Как предсказать гипероним слова (и зачем). Моё участие в соревновании по пополнению таксономии

Как может машина понимать смысл слов и понятий, и вообще, что значит - понимать? Понимаете ли вы, например, что такое спаржа? Если вы скажете мне, что спаржа - это (1) травянистое растение, (2) съедобный овощ, и (3) сельскохозяйственная культура, то, наверное, я останусь убеждён, что вы действительно знакомы со спаржей. Лингвисты называют такие более общие понятия гиперонимами, и они довольно полезны для ИИ. Например, зная, что я не люблю овощи, робот-официант не стал бы предлагать мне блюда из спаржи. Но чтобы использовать подобные знания, надо сначала откуда-то их добыть.

В этом году компьютерные лингвисты организовали соревнование по поиску гиперонимов для новых слов. Я тоже попробовал в нём поучаствовать. Нормально получилось собрать только довольно примитивный алгоритм, основанный на поиске ближайших соседей по эмбеддингам из word2vec. Однако этот простой алгоритм каки

import numpy as np
import scipy.optimize
from sklearn.linear_model import Ridge
from sklearn.isotonic import IsotonicRegression
from sklearn.base import BaseEstimator, RegressorMixin
class MonotonicRegression(BaseEstimator, RegressorMixin):
""" Smooth increasing piecewise linear regression.
During training, it minimizes MSE and the sum of absolute changes in its slope.
@Sandy4321
Sandy4321 / conceptnet5_russified.ipynb
Created May 25, 2023 21:21 — forked from avidale/conceptnet5_russified.ipynb
conceptnet5_russified.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sandy4321
Sandy4321 / t5_extra_models.py
Created May 25, 2023 21:21 — forked from avidale/t5_extra_models.py
T5ForSequenceClassification
import torch
import copy
from torch import nn
from transformers import T5PreTrainedModel
from transformers.models.t5.modeling_t5 import T5Stack
from transformers.modeling_outputs import SequenceClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
def mean_pooling(inputs, mask):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sandy4321
Sandy4321 / pseudo-ppl.ipynb
Created May 25, 2023 21:17 — forked from avidale/pseudo-ppl.ipynb
pseudo-ppl.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sandy4321
Sandy4321 / bert-ner-ru.ipynb
Last active May 25, 2023 21:17 — forked from avidale/bert-ner-ru.ipynb
Bert-NER-ru
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.