## hadoop – How to classify text in Mahout after constructing a naive Bayesian model?

I followed the Hadoop MapReduce cookbook to create a Mahout Naive Bayes classification model of the 20news dataset. The important and relevant commands I have executed (after making some changes because I use Mahout 0.13 now, the book is a bit old) to get the final test result were (in the order ):

1. hadoop fs -put 20_newsgroups / * 20news-all

2 main catalog -i 20news-all -o 20news-seq

3 mahout seq2sparse -i 20news-seq -o 20news-vector

4 mahout split -i 20news-vector / tfidf-vectors -tr 20news-train-vectors
20news-vectors-of-test -rp 40 -subse -seq -xm sequential

5 mahout trainnb -i 20news-train-vectors -o model -li labelindex

6 mahout testnb -i 20news-train-vectors -m model -l labelindex -o
20news-testing

After that, I got the result:

Everything is fine.

My question is if I can sort a string of text, for example, "The situation in the Middle East continues to remain volatile, something … xyz ….." or a file containing the string above with the help of the mahout command and based on the template that I created at step 5.?

NOTE: I want the release to be the subject in which it is classified as sci.electronics.

## Computational Geometry – Constructing an Inverted No-Fit Polygon

I need a robust algorithm to optimally fit a non-convex polygon to another. The destination may contain holes.

Recently, I found scientific articles on this topic:

One of them describes how to match one list of polygons to another. Building a polygon without adjustment here is mentioned as one of the steps.

Another describes a robust and concrete way of building a polygon without adjustment with good complexity.

The only problem I have is that in this paper different things are considered unadjusted polygons.
In the first case, it is inside the polygon, while in the second, it looks like another outside and has a different meaning.

I understand that the notion of "non-adjustment-polygon" is described in the second article, but how can I be "inverted", as in the first picture? Maybe it is possible to adjust the algorithm from the second article for this case?

I would also like the solution to be implementable in the code.

Any help appreciated.

## constructing the function – how to perform a conv2 equivalent conv2 of two vectors in Mathematica?

I have a matlab code

``````filter = 1;
F = conv2 (double ([1 2 1]),double([1 2 1]& # 39;)) / 16;
for i = 1: some_integer
filter = conv2 (double (filter), double (F));
end
``````

in the code `F = conv2 (double ([1 2 1]),double([1 2 1]& # 39;)) / 16;` equals
a 3 x 3 matrix `{{0,0625, 0,125, 0,0625}, {0,125, 0,25, 0,125}, {0,0625, 0,125, 0,0625}}`

the filter changes the value of the first iteration from 1 to `F` and then, successive iterations, the result (convolution matrix) becomes larger and larger.

I have trouble making this convolution in Mathematica, despite the review of the documentation. An idea of ​​how one could make such a convolution?

my attempt below to calculate F before the loop seems incorrect.

`F = Flatten[(ListConvolve[{{0, 0, 0}, {1, 2, 1}, {0, 0, 0}}, {{1, 2, 1}, {1, 2, 1}, {1, 2, 1}}, {-1, 1}, g, Plus, List]/16.0), 2]`

## formal languages ​​- Constructing a deterministic stack automaton for a given grammar

I'm trying to build a DPDA for the given grammar:

$$S to aR$$
$$R to bRT | varepsilon$$
$$T to cSR | varepsilon$$

I first tried to simplify the grammar (by removing null and unit productions, useless and inaccessible symbols), removing the axiom $$S$$ of productions (with correction generating zero and unit productions, of course). By converting it into Greibach's normal form I got myself:

$$S to a | aR$$
$$P to a | aR$$
$$R to b | bT | bR | bRT$$
$$T to cP | cPR$$

I am always short of knowing how to build a DPDA from this. Along the way, I learned that DPDAs are usually set to accept an input string if and only if the entire string has been read and an end state has been reached (that the stack is empty or not).

I am aware that there is no algorithm for converting an NPDA to DPDA, even if there is a suitable DPDA for the language. I suspect that the language defined by my grammar might not be recognized by a DPDA. Yet, if that's the case, I do not know how to prove it.

What do I forget here?