Here is the code folks: import pandas as pd from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train_test_split from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import accuracy_score, classification_report, confusion_matrix from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline df = pd.read_csv('sentiment_multifeaturedata.csv') # Define columns for feature extraction text_cols = ['Text', 'Explanation','SpecificPhraseWord','Category'] # Split data into training and testing sets X_train, X_test, y_train, y_test = train_test_split(df[text_cols], df['Sentiment'], test_size=0.2, random_state=42) # Create pipeline with ColumnTransformer and MultinomialNB pipeline = Pipeline([ ('vectorizer', ColumnTransformer([ ('text_vectorizer', TfidfVectorizer(stop_words='english'), 'Text'), ('expl_vectorizer', TfidfVectorizer(stop_words='english'), 'Explanation'), ('phrase_vectorizer', TfidfVectorizer(stop_words='english'), 'SpecificPhraseWord'), ('cat_vectorizer', TfidfVectorizer(stop_words='english'), 'Category') ])), ('clf', MultinomialNB()) ]) # Train pipeline on training data pipeline.fit(X_train, y_train) # Make predictions on testing data y_pred = pipeline.predict(X_test) # Evaluate pipeline performance print("Accuracy:", accuracy_score(y_test, y_pred)) print("Classification Report:") print(classification_report(y_test, y_pred)) print("Confusion Matrix:") print(confusion_matrix(y_test, y_pred)) #Predict the output on the input data from user: while True: user_input = input("Enter your text: ") # Create a DataFrame with user input user_df = pd.DataFrame([user_input], columns=['Text']) # Add other columns (Explanation, SpecificPhraseWord, Category) if necessary user_df['Explanation'] = '' user_df['SpecificPhraseWord'] = '' user_df['Category'] = '' # Use pipeline to predict sentiment user_prediction = pipeline.predict(user_df) # Print predicted sentiment print("Predicted Sentiment:", user_prediction[0])
@govindkaushik796725 күн бұрын
this video gave lot of understanding🙏
@govindkaushik796725 күн бұрын
thank you sir
@fanforeverclipsАй бұрын
is it Complete Playlist for socket programming ?
@manishpatil331Ай бұрын
Thanks for video😊
@umarfarooque8293Ай бұрын
Sir I want to learn Boost.ASIO from basic to Advanced. Please make a playlist for Boost.ASIO
@AkshayKumar-eu3ypАй бұрын
Would Like to Recommend this series to all who want to make their career in AI Filed
@AkshayKumar-eu3ypАй бұрын
Awesome sir
@marinielgalvao5259Ай бұрын
For me select(nMaxFd + 1, &fr, &fw, &fe, &tv); always returns 0...
@etis3129Ай бұрын
Hi Sir if i want to use IPROTO_SCTP instead of IPROTO_TCP will it work or do i have to change the program as well?
@vartetalearningplatform2271Ай бұрын
It should work
@vartetalearningplatform2271Ай бұрын
Code: import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import CountVectorizer from sklearn.naive_bayes import MultinomialNB '''' You can ask the available models to generate the text and sentiment for you for varioud moods. Generate it in various categories like delay, wrong response, ''' # Load the dataset (assuming a CSV file with 'text' and 'sentiment' columns) import pandas as pd df = pd.read_csv('sentiment_data.csv') # Tokenize the text data nltk.download('punkt') nltk.download('wordnet') nltk.download('stopwords') lemmatizer = WordNetLemmatizer() stop_words = set(stopwords.words('english')) def preprocess_text(text): tokens = word_tokenize(text) tokens = [t for t in tokens if t.isalpha()] tokens = [lemmatizer.lemmatize(t) for t in tokens] tokens = [t for t in tokens if t not in stop_words] return ' '.join(tokens) df['text'] = df['text'].apply(preprocess_text) # Split data into training and testing sets X = df['text'] y = df['sentiment'] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) # Vectorize the text data using TF-IDF vectorizer = TfidfVectorizer() X_train_tfidf = vectorizer.fit_transform(X_train) X_test_tfidf = vectorizer.transform(X_test) cVectorizer = CountVectorizer() X_train_count = cVectorizer.fit_transform(X_train) X_test_count = cVectorizer.transform(X_test) # Initialize the Multinomial Naive Bayes classifier clf = MultinomialNB() # Train the classifier using the training data clf.fit(X_train_count, y_train) # Define a function to predict the sentiment of a user's input def predict_sentiment(text): text_count = vectorizer.transform([text]) prediction = clf.predict(text_count) return prediction[0] # Test the function user_input = input("Enter your text: ") print(predict_sentiment(user_input))
@mastermind97112 ай бұрын
Thank you sir, looking forward to this series. Also sir if possible, could you please make some tutorials on drogon or crow framework for c++?
@vartetalearningplatform2271Ай бұрын
Sure
@mastermind9711Ай бұрын
@@vartetalearningplatform2271 Thank you very much sir!
@VinodPatel-s8x2 ай бұрын
Vikas sir,IPC aur multithreading pe bhi vedio banaiye
@rinkiradigo2 ай бұрын
Highly recommend watching it 👍
@KRISHNAKUMAR-hi4ii2 ай бұрын
sir why my code is not working in vs code
@infini63382 ай бұрын
The message is not received at server from client. The server stops after sending sending acknowledgement of connection received. I cannot send first message from client to server. The nRet of server becomes zero..
@infini63382 ай бұрын
the program is not working winsock2.h file not found error
@anil842003082 ай бұрын
I think, it would be better Toolbox, solution explorer can be minimized so that code editor look bigger.
@ronit1723 ай бұрын
You have channel Viswaguru
@amangelool3 ай бұрын
Parentheses are not needed or recommended based on what I read.
@DeepF-r5g3 ай бұрын
Wonderful example. Hidden gem.
@Moto-iz4cj4 ай бұрын
File access in C padhayiye, please.
@adityasoni75724 ай бұрын
Awesome
@Moto-iz4cj5 ай бұрын
Yadi aap nahi padhana chahte to bhi bass ye 3 topics indepth me padha dijiye jaise aap padhate ho, Please. 1. Memory Management 2. File Access 3. Structs
@vartetalearningplatform22714 ай бұрын
ओके.. मै देखता हूँ
@Moto-iz4cj4 ай бұрын
@@vartetalearningplatform2271 thank you, sir
@Moto-iz4cj5 ай бұрын
Sir, please next video bhi lao na.
@Yan-yx5nb5 ай бұрын
you just need a std:thread or creatthread ,and you can implent this.
@aditya.singhal5 ай бұрын
counter should not be handled using static keyword as it will be common for all instances of the shared_ptr class. This will not work when I create a instance of shared_ptr class to point to a new int resource in the memory.
@_v0id3095 ай бұрын
I am creating a network scanner in c++ so I needed to learn about sockets and I saw your playlist , it's actually amazing sir ❤ lot's of love ❤
@Enerzon6 ай бұрын
Sir, Bas itna hi hai kya C programming me ??
@vartetalearningplatform22716 ай бұрын
कोई व्यू नहीं आ रहे भाई...
@Enerzon5 ай бұрын
@@vartetalearningplatform2271 Samajh sakta hu, par main to padhta hu na. Aap banate raho video, Please...
@greydogyoutube6 ай бұрын
wtf! this is ms documentation!
@bigdatapartner6 ай бұрын
ASW LECTURE.EASY TO UNDERSTAND . GOOD FOR BEGINNERS
@RaveedUllahUsmani6 ай бұрын
what is the purpose of MaxFd?
@chiragsharma1546 ай бұрын
Nicely explain. Understood the Lambda now.
@kaoutariabakriman30616 ай бұрын
Please can you give us a the code source.I write the same thing but i find mistakes in my code .I didn't get the same answer you get
@manishpatil3317 ай бұрын
Could you make a video on design patterns please ?
@manishpatil3317 ай бұрын
Thanks for video
@amarnathgandhi24267 ай бұрын
Hi vikas sir Could you help me to clear one doubt Suppose if have a interger vector contains some duplicate values i want to remove these value without change the order of vector elements how i can ?? Pls help me sir
@vartetalearningplatform22717 ай бұрын
You are talking about the vectors in STL?
@amarnathgandhi24267 ай бұрын
Yes sir
@messager30007 ай бұрын
Thank you for these videos, I progressed a lot thanks to you !
@Enerzon8 ай бұрын
Sir, scanf() returns number Of Input scanned. Ye maine Reverse-Engeneering me padha tha.
@vartetalearningplatform22718 ай бұрын
Great!! That's the right answer!!
@Enerzon8 ай бұрын
Sir, I've a confusion. Pehle value increase hoti hai and then wo compair hoti hai to jab loop me k=10 tha to wo increment Hokar 11 ho gayi. 11 is not <=10 to is condition me to while statement false ho gayi na to while ke under printf() execute nahi honi chahiye.
@Enerzon8 ай бұрын
I think, Pehle compair hoti hai then increase and then print. 1<=10 -------> 1++ ------> 2----> printf. 10<=10 ------> 10++ -----> 11---> printf.
@vartetalearningplatform22718 ай бұрын
@@Enerzon yes, saare kaam ek line me ho jaate hain..++ ka rule waise hee kaam karta hai ki pahle operation perform karo and then increment
@Enerzon8 ай бұрын
conio.h unidentified header file bata raha hai, GCC me ???
@vartetalearningplatform22718 ай бұрын
Yes in gcc it may not be there
@Enerzon8 ай бұрын
Sir, every Sunday ko excercise video. Aur Ham aage system calls bhi padhenge na??
@gp076vikashshakya98 ай бұрын
Yes
@Enerzon8 ай бұрын
Sir, Ham system calls bhi padhenge na ???
@gp076vikashshakya98 ай бұрын
Unix wali?
@NeelamSomannavar8 ай бұрын
kindly mention the IDE used for socket programming
@vartetalearningplatform22718 ай бұрын
Use Visual Studio 2022
@sarael82618 ай бұрын
sous-titres please
@Enerzon8 ай бұрын
Sir, please continuously video daliye. 1 video per Day.
@chryselysdemo8 ай бұрын
@vartetalearningplatform2271 Can we pass a custom response format as prompt for this agent?
@vartetalearningplatform22718 ай бұрын
Yes
@vartetalearningplatform22718 ай бұрын
The code is here: from langchain.agents.agent_types import AgentType from langchain_experimental.agents.agent_toolkits import create_csv_agent from langchain_openai import ChatOpenAI, OpenAI import os agent = create_csv_agent( ChatOpenAI(api_key = os.environ.get('OPENAI_API_KEY'), temperature=0, model="gpt-3.5-turbo-0613"), "churn.csv", verbose=True, agent_type=AgentType.OPENAI_FUNCTIONS, handle_parsing_errors = True, ) user_input = input('Please ask your question:') agent.invoke(user_input)
@vartetalearningplatform22718 ай бұрын
from langchain.prompts import PromptTemplate from langchain.llms import OpenAI from langchain.chains import LLMChain from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder import os user_input = input("Enter a topic: ") prompt = ChatPromptTemplate.from_messages( [ ( "system", "You are very powerful assistant, but can't answer anything on General Knowledge", ), ("user", "Give the answer to this topic: {topic}"), ] ) llm = OpenAI(api_key= os.environ.get('OPENAI_API_KEY'), temperature = 0) chain = LLMChain(llm=llm, prompt=prompt) output = chain.run(user_input) print(output)