I am doing association mining on a dataset I got from the WEKA website about hypothyroidism.
Each entity is a person. Each person has an attribute called class which can contain {negative, primary_hypothyroidism, secondary_hypothyroidism}
class = {negative, primary_hypothyroidism, secondary_hypothyroidism}
I want to delete the whole person that has negative. How do I do this inside WEKA?
There is a filter called "RemoveWithValues" that will do what you ask.
If you are using the Weka GUI you can do the following:
Select the filter under filters > unsupervised > instance > RemoveWithValues
Click the box that contains the text describing the filter.
Identify the "attributIndex" (the index where your class is held).
Identify the "nominalIndices" (in your case it would be first).
Click Apply!
If you are using Java code you can read up on applying filters here.
Related
I want to calculate confusion matrix, f1 score, roc etc. But the Weka output is showing this. How can I get the confusion matrix, f1 score, roc, etc?
First of all, your dataset seems to have a numeric class attribute. Correlation coefficient is a statistic generated for regression models. A confusion matrix (which you want) is only computed for classification models.
Secondly, you are using ZeroR as classifier, which is not a very useful classifier (only for determining a baseline). ZeroR either predicts the mean class value (numeric class attribute) or the majority class (nominal class attribute).
Solutions:
Ensure that you are using the right attribute for your class. Assuming that you are using the Weka Explorer, check the combobox on the Classify panel that it has the right attribute selected. On the command-line, use the -c flag to specify the index of the class attribute (1-based index, first and last can be used as well).
If you imported your data from a CSV file and the class attribute column contains only numeric values, then Weka will have left it as numeric (it doesn't know that this column represents a nominal attribute). In that case, make sure that you convert your class attribute to a nominal one, e.g., by using the NumericToNominal filter in the Preprocess panel.
Choose a different classifier, like RandomForest or J48, which tend to generate reasonable models with just the default parameters.
I have created a new prediction model based on a dataset that was given to me. It predicts a nominal (binary) class attribute (positive/negative) based on a number of numerical attributes.
Now I have been asked to use this prediction model to predict classes for a new dataset. This dataset has all the same attributes except for the class column, which does not exist yet. How do I apply my model to this new data? I have tried adding an empty class column to my new dataset and then doing the following:
Simply loading the new dataset in WEKA's explorer and loading the model. It tells me there is no training data.
Opening my training set in WEKA's explorer and then opening my training model, then choosing my new data as a 'supplied test set'. It runs but does not output any predictions.
I should note that the model works fine when testing on the training data for cross validation. It also works fine with a subset of the training data I separated ages ago for test/eval use. I think it may be a problem with how I am adding a new class column, maybe?
For making predictions, Weka requires the two datasets, training and the one for making predictions, to have the exact same structure, down to the order of labels. That also means, that you need to have a class attribute with the correct labels present. In terms of values for your class attribute, simply use the missing value (denoted by a question mark).
See the FAQ How do i make predictions with a trained model? on the Weka wiki for more information on how to make predictions.
I need to do feature selection using information gain in learning to rank. I try to use Weka to implement this. But I found in "Select attributes"-"Attribute Evaluator", the "InfoGainAttributeEval" is not available to use. I do not know how to install it and make it available. Anybody knows how to fix this problem?
This usually means that something about your dataset is not compatible with the technique you are trying to use.
Although the InfoGainAttributeEval entry is greyed out in the list, you should still be able to select it (note the Start button is now greyed out), click on its name and then click Capabilities which should show you:
CAPABILITIES
Class -- Binary class, Missing class values, Nominal
class
Attributes -- Binary attributes, Date attributes, Empty nominal
attributes, Missing values, Nominal attributes, Numeric attributes,
Unary attributes
Does your data have attributes that don't match these requirements, or have you selected a class attribute that doesn't match the class requirements?
I currently have a search button and I would like to search a specific column of my model.Thus I just want the matching rows to be displayed in my tableview.
I have attached a QSortFilterProxyModel* object as a source to the table view and have set a QStandardItemModel* as its source. Then with my search button I made the following connection
QObject::connect(ui.lineEditSearch,SIGNAL(textChanged(QString)),proxyModelFilter,SLOT(setFilterFixedString(QString)));
Now I was under the impression that upon typing the relevant rows will be returned. Then I realized that I havent specified as to which columns I want the filter proxy model to search.
I understand that I could implement a class that inherits from QSortFilterProxyModel and re implement its filterAcceptsRow. I wanted to know if there was a way for me to avoid creating a class that inherits from QSortFilterProxyModel and simply use the QSortFilterProxyModel class only to tell which columns to search on when the Slot setFilterFixedString is called ?
The column to filter by can be set via QSortFilterProxyModel::filterKeyColumn.
It allows to specify a single column, or all of them (-1, the default).
Alternatively, one can define a custom filter role returning a concatenation of all string to search for, and set it via setFilterRole().
I write a small database project for handling payroll records. These payroll records will be put into a tableview object for viewing. How can I search a particular record in a TableView ? Any idea, please help me.
If you are using model / view paradigm, you may consider using a "match()" method, located in the QAbstractItemModel class. For example, see this code snippet:
model->match(model->index(0,0),
Qt::DisplayRole,
pattern, -1,
Qt::MatchContains | Qt::MatchRecursive );
This is a code, I use to locate a pattern string in the TreeView. The flags are set to locate those records, that have a "pattern" among their display role representation, the search is performed recursively through the tree (you don't need it in your TableView, I believe :) ).
A Proxy-Model can be plugged between your (source) model and the view(s) to filter the models data. Take a look at QSortFilterProxyModel which allows to sort models rows/columns. Providing it with the right regexp for the key it will match only one item if found. You can use the proxy-model like a usual model (e.g. check rowCount) so it will update automatically and can be used in other views.