0

Would it be accurate to include an expert system in an image classifying application? (I am working with Matlab, have some experience with image processing and no experience with expert systems.)

What I'm planning on doing is adding an extra feature vector that is actually an answer to a question. Is this fine?

For example: Assume I have two questions that I want the answers to : Question 1 and Question 2. Knowing the answers to these 2 questions should help classify the test image more accurately. I understand expert systems are coded differently from an image classifier but my question is would it be wrong to include the answers to these 2 questions, in a numerical form (1 can be yes, and 0 can be no) and pass this information along with the other feature vectors into a classifier.

If it matters, my current classifier is an SVM.

Regarding training images: yes, they too will be trained with the 2 extra feature vectors.

john
  • 1,561
  • 3
  • 20
  • 44
  • Depends. What are your other features? How are the other features normalized? Which kernel do you use in SVM? As a short anwser, take a look at the same question made in [crossvalidated](https://stats.stackexchange.com/questions/82923/mixing-continuous-and-binary-data-with-linear-svm). – Imanol Luengo Mar 16 '16 at 09:08
  • Other features are texture details from Matlab's `graycoprops`. No, they are not normalized. SVM uses the default linear kernel. – john Mar 16 '16 at 09:12
  • Then, as long as you *standarize* the texture features (to each column substract the mean and divide it by its standard deviation) and encode the binary variables as `(-1, 1)` the linear SVM should perform well (as the answer of the linked question states). Whether it will increase or not your performance depends on the quality of those binary variables. – Imanol Luengo Mar 16 '16 at 09:16
  • Thank you! Can you tell me why it will be a problem if I use a different kernel for my SVM or if I don't standardize the values? – john Mar 16 '16 at 09:24

2 Answers2

2

Converting a set of comments to an answer:

A similar question in cross-validated already explains that it can be done as long as data is properly preprocessed.

In short: you can combine them as long as training (and testing) data is properly preprocessed (e.g. standardized). Standardization improves the performance of most linear classifiers because it scales the variables so they have the similar weight in the learning process and improves the numerical stability (and performance) when variables are sampled from gaussian-like distributions (which is achieved by standarization).

With that, if continuous variables are standardized and categorical variables are encoded as (-1, +1) the SVM should work well. Whether it will improve or not the performance of the classifier depends on the quality of those cathegorical variables.

Answering the other question in the comment.. while using kernel SVM with for example a chi square kernel, the rows of the training data are suppose to behave like histograms (all positive and usually l1-normalized) and therefore introducing a (-1, +1) feature breaks the kernel. Using a RBF kernel the rows of the data are suppose to be L2 normalized, and again, introducing (-1, +1) features might introduce unexpected behaviour (I'm not very sure what exactly the effect would be..).

Imanol Luengo
  • 15,366
  • 2
  • 49
  • 67
  • Thanks for your answer. Just a quick question, is standardization the same as normalization in Matlab? – john Mar 16 '16 at 14:47
  • @john yes, but no at the same time. Normalization in matlab would apply to the whole matrix. You want to normalize each of the columns. This answer in mathworks shows [how to do that in matlab](http://uk.mathworks.com/matlabcentral/answers/24481-normalizing-data#answer_32151). – Imanol Luengo Mar 16 '16 at 16:24
  • I understand this normalizes the columns to values ranging from 0-1 (each column's values total to 1 as well). In your answer you said that categorical variables are set to `+1` or `-1`. The `-1` seems a little off to me. Wouldn't that offset the accuracy as it's the only value in the negatives? – john Mar 16 '16 at 17:15
  • @john No, it doesn't normalize the columns to `[0, 1]`. Substracting the mean and dividing by the std (standard deviation) of each column will put each column with mean=0 and std=1, which means values will range from `[-a, +b] ` being the mean of each column 0. (if `[0,1]` is what matlabs `normalize` does, then my previus *yes* answer was wrong sorry haha, not a matlab user). – Imanol Luengo Mar 16 '16 at 18:43
  • Thanks for your help. I went ahead and coded this up in Matlab and all my test data is being classified into `category 1` and none to `category 2`. This might have been something I overlooked so let me recap what I did. I normalized all the training data, column wise, so the max value would be `1` and the min value would be `-1` and the rest would be distributed inbetween. Next I added the 2 category variables, `-1` for `no` and `+1` for `yes`. Now what about the test data? So far, I'm just passing it as it is. No normalization, and its category values are similar to training category values. – john Mar 20 '16 at 05:06
  • To add to the above, if the user left the category question blank, I passed the value as `0`. Is this acceptable? – john Mar 20 '16 at 05:29
1

I worked on similar problem. if multiple features can be extracted from your images then you can train different classifier by using different features. You can think about these classifiers as experts in answering questions based on the features they used in training. Instead of using labels as outputs, it is better to use confidence values. uncertainty can be very important in this manner. you can use these experts to generate values. these values can be combined and used to train another classifier.

Bashar Haddad
  • 369
  • 2
  • 10