Deep Learning Structure for Cross-Domain Sentiment Classification Based on Improved Cross Entropy and Weight

Algorithm 1

Text sentiment analysis algorithm based on W-RNN.

Input:

CWE-word vector

CTR-training corpus

CTE-test corpus

Output: Prediction results of test samples.

(1)

pro_processing (CWE)

(2)

Dict = word2vec (CWE)//create the word vector dictionary Dict

(3)

batches [] ⟵ Divide (CTR)//divide CTR into several batches

(4)

for i ⟵ 0 to epochs do

(5)

for j ⟵ 0 to length (batches) do

(6)

for k ⟵ 0 to length (batches[j]) do

(7)

⟵ FindWord (batches [j][k])//find the words vector in batches[j][k] from Dict

(8)

h ⟵ //the feature vector h is extracted from

(9)

h′ ⟵ Measure (h)//measure the impact of h

(10)

⟵ Sort (,h’)//sort words vector in descending order according to h’

(11)

c ⟵ ExtractFeature ()//extract secondary feature from the word vector

(12)

z ⟵ Softmax (c)//Get the prediction results of samples by Softmax classifier

(13)

end for

(14)

Update (z, , (b)//update parameters and b of the model by backpropagation

(15)

end for

(16)

end for

(17)

for i ⟵ 0 to length (CTE) do

(18)

⟵ FindWord (CTE [i])

(19)

h ⟵

(20)

h’ ⟵ Measure (h)

(21)

⟵ Sort (,h’)

(22)

c ⟵ ExtractFeature ()

(23)

output ⟵ Softmax (c)

(24)

end for

We are committed to sharing findings related to COVID-19 as quickly as possible. We will be providing unlimited waivers of publication charges for accepted research articles as well as case reports and case series related to COVID-19. Review articles are excluded from this waiver policy. Sign up here as a reviewer to help fast-track new submissions.