question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error using PassiveAgressiveClassifier on Text Data

See original GitHub issue

Hello, I’m trying to use the PassiveAgressive classifier on my confidential text dataset. I’m getting the following error on Google Colab Environment=> TypeError: unsupported operand type(s) for -: ‘str’ and ‘int’

This is the code I’m using, X is the text dataframe and y is a Series describing the labels (i.e., category)

Python 3.9.15: Windows:

Steps/code to reproduce

model = linear_model.PAClassifier(C=0.1, mode=1)
pipe_pac = Pipeline(('vectorizer',BagOfWords(lowercase=True,ngram_range=(1, 3))),('pac',model))
X= df['Text']
y= df['CATEGORY']

X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=0.3, random_state = 0)
newdf = pd.concat([X_train, pd.DataFrame(y_train)], axis=1)

data = list(zip(*map(newdf.get, newdf)))

for text,label in data:
    pipe_pac = pipe_pac.learn_one(text,label)

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
smastelinicommented, Dec 6, 2022

How about using something like this?

1reaction
MaxHalfordcommented, Dec 6, 2022

I was just wondering if there is a way to use river to classify a 2-level hierarchy, that is passing the labels as a 2-d array (e.g., product, sub-product).

Sadly not yet no 😃

It is on the roadmap though to frame multi-class classification as a tree of binary classifiers. But it will take a lot of work to get that done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passive Aggressive Classifier: Concepts & Examples
The passive aggressive classifier is a machine learning algorithm that is used for classification tasks. This algorithm is a modification of ...
Read more >
ValueError: The number of class labels must be greater than ...
ValueError: The number of class labels must be greater than one in Passive Aggressive Classifier ... I am trying to implement an online...
Read more >
passiveaggressiveclassifier · GitHub Topics
This Python project detect fake and real news using PassiveAggressiveClassifier. sklearn-library passiveaggressiveclassifier. Updated on Feb 18, 2021; Jupyter ...
Read more >
Text Classification 3: Passive Aggressive Algorithm - YouTube
http://bit.ly/LeToR] The Passive Aggressive (PA) algorithm is perfect for classifying massive streams of data (e.g. Twitter).
Read more >
Passive Aggressive Classifiers - GeeksforGeeks
In online machine learning algorithms, the input data comes in sequential order and the machine learning model is updated step-by-step, as ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found