top of page

Fake News Detection In Machine Learning

realcode4you

Import Libraries

from keras.models import Sequential
import pandas as pd
import numpy as np
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
from keras.layers import Dense, Flatten, LSTM, Conv1D, MaxPooling1D, Dropout, Activation
from keras.layers.embeddings import Embedding
from keras.preprocessing.text import text_to_word_sequence


Mount Drive


from google.colab import drive
drive.mount('/content/drive')

Read Data Path

loc = '/content/drive/My Drive/fake/'

Read Dataset

# loading the a train set
tr = pd.read_csv(loc+'train.csv')
tr.dropna(inplace=True)
tr.head()

output:


Loading Test Data


#loading the test set
ts = pd.read_csv(loc+'test.csv')
ts.dropna(inplace=True)
ts.head()

Ouput:


Length of both dataset:

len(tr),len(ts)

(18285, 4575)


# using only 3000 record  to reduce memory usage , increase the numbers below to increase the data.
tr = tr.iloc[:2000,:]
ts = ts.iloc[:1000,:]
tr.label.value_counts()
len(tr)
# cleaning data
tr.replace(r'\b\w{1,3}\b','', regex =True, inplace = True)neuralNetwork.fit(emb, y_tr, epochs=1)
tr.replace(r'\b\w{1,3}\b','', regex =True, inplace = True)
tr.head()

Output:



Get complete solution of this? Send your details at:



Yorumlar


REALCODE4YOU

Realcode4you is the one of the best website where you can get all computer science and mathematics related help, we are offering python project help, java project help, Machine learning project help, and other programming language help i.e., C, C++, Data Structure, PHP, ReactJs, NodeJs, React Native and also providing all databases related help.

Hire Us to get Instant help from realcode4you expert with an affordable price.

USEFUL LINKS

Discount

ADDRESS

Noida, Sector 63, India 201301

Follows Us!

  • Facebook
  • Twitter
  • Instagram
  • LinkedIn

OUR CLIENTS BELONGS TO

  • india
  • australia
  • canada
  • hong-kong
  • ireland
  • jordan
  • malaysia
  • new-zealand
  • oman
  • qatar
  • saudi-arabia
  • singapore
  • south-africa
  • uae
  • uk
  • usa

© 2023 IT Services provided by Realcode4you.com

bottom of page