Chat with us, powered by LiveChat Python program about LDA Parameter Tunning | WriteDemy

Question Description

Q1:LDA Parameter Tunning

Define a function tune_lda() as follows:

Takes two file name strings as inputs: train_f ile is the file path of text_train.json, and test_f ile is the file path of text_test.json

Fits LDA models (from gensim package) using documents from train_f ile with different parameter values:

Number of clusters (K ) from 2 to 6

Topic distribution prior (i.e. α): 'symmetric' (i.e. α = [1, 1, 1, . . . ] ), 'asymmetric' (i.e.

α = [1/K, 1/K, 1/K, . . . ] ), and 'auto' (i.e. the prior is calculated based on word frequency)

With all parameter combinations, in total, you'll train 15 LDA models. When fitting each model, set the maximum number of iterations to 40 to make sure your model converges. Note, it may take a few minutes to train all models.

For each model, calculate topic coherence using 'u_mass' formula. The details of coherence can be found at https://radimrehurek.com/gensim/models/coherencemo… (https://radimrehurek.com/gensim/models/coherencemo…). Read the paper referenced in the link to make sure you understand the meaning of topic coherence. Note, 'c_v' instead of 'u_mass' is recommended to evaluate topic coherence. For simplicity, let's use 'u_mass' here. However, if you can figure out how to use 'c_v', that's even better.

Create a plot to show how topic coherence changes as the K increases under different α values (i.e., a line for each α value).

Based on the plot, determine best K and α values in terms of topic coherence

This function does not have a return. Write a document to show:

best parameter combination in terms of topic coherence

do you think topic coherence is a good metric for you to choose K ?

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

About Writedemy

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Place Order” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order