Views
No views yet

pip install git+https://github.com/flexudy/natural-language-logic.git@v0.0.11from flexudy.conceptor.start import FlexudyConceptInferenceMachineFactory
2
3# Load me only once
4concept_inference_machine = FlexudyConceptInferenceMachineFactory.get_concept_inference_machine()
5
6# A list of terms.
7terms = ["cat", "dog", "economics and sociology", "public company"]
8
9# If you don't pass the language, a language detector will attempt to predict it for you
10# If any error occurs, the language defaults to English.
11language = "en"
12
13# Predict concepts
14# You can also pass the batch_size=2 and the beam_size=4
15concepts = concept_inference_machine.infer_concepts(terms, language=language){'cat': ['mammal', 'animal'], 'dog': ['hound', 'animal'], 'economics and sociology': ['both fields of study'], 'public company': ['company']}2 to 4 concepts at random for each term. This means, there is still great potential to make the models generalise better 🚀.279884 training examples and 1260 for testing. Edges -- i.e IsA(concept u, concept v) -- in both sets are disjoint.15K steps with learning rate linear decay during each step. Starting at 0.001RAdam Optimiser with weight_decay =0.01 and batch_size =36.64.| Metric | Score |
|---|---|
| Exact Match | 36.67 |
| F1 | 43.08 |
| Loss smooth | 1.214 |
2% F1).100% precision.