1
0
mirror of https://github.com/gsi-upm/senpy synced 2025-08-23 18:12:20 +00:00

Release 0.20

This commit is contained in:
J. Fernando Sánchez
2019-04-04 12:36:35 +02:00
parent 8a516d927e
commit 9758a2977f
3 changed files with 24 additions and 7 deletions

View File

@@ -320,24 +320,32 @@ class PluginsTest(TestCase):
for i in range(50):
testdata.append(["good", 1])
for i in range(50):
testdata.append(["bad", 0])
testdata.append(["bad", -1])
dataset = pd.DataFrame(testdata, columns=['text', 'polarity'])
class DummyPlugin(plugins.SentimentBox):
description = 'Plugin to test evaluation'
version = 0
classes = ['marl:Positive', 'marl:Negative']
def predict_one(self, features, **kwargs):
return 0
print(features[0])
return [0, 1]
class SmartPlugin(plugins.SentimentBox):
description = 'Plugin to test evaluation'
version = 0
classes = ['marl:Positive', 'marl:Negative']
def predict_one(self, features, **kwargs):
print(features[0])
if features[0] == 'good':
return 1
return 0
print('positive')
return [1, 0]
print('negative')
return [0, 1]
dpipe = DummyPlugin()
results = plugins.evaluate(datasets={'testdata': dataset}, plugins=[dpipe], flatten=True)