[GRASS-user] Problem with v.class.mIR

Hi,
I’m trying to use this module for classification of an old aerial photos.

After a segmentation (i.segment and i.segment.stats), I would to use a machine learning approach for the real classification.
I tried with v.class.mIR which use also R.

But there is an error and I don’t know how to solve it:
Durante l’avvio - Warning messages:
1: Setting LC_CTYPE=it_IT.cp1252 failed
2: Setting LC_COLLATE=it_IT.cp1252 failed
3: Setting LC_TIME=it_IT.cp1252 failed
4: Setting LC_MONETARY=it_IT.cp1252 failed
Carico il pacchetto richiesto: caret
Carico il pacchetto richiesto: lattice
Carico il pacchetto richiesto: ggplot2
Error in $<-.data.frame(*tmp*, fd, value = integer(0)) :
replacement has 0 rows, data has 11
Calls: $<- → $<-.data.frame

A part is in italian, I’m sorry.

I’m a beginner in grass and R.
Thanks in advance,
Giuseppe

On 20/11/19 11:55, Giuseppe Cillis wrote:

Hi,
I'm trying to use this module for classification of an old aerial photos.
After a segmentation (i.segment and i.segment.stats), I would to use a machine learning approach for the real classification.
I tried with v.class.mIR which use also R.
But there is an error and I don't know how to solve it:
*/Durante l'avvio - Warning messages:
1: Setting LC_CTYPE=it_IT.cp1252 failed
2: Setting LC_COLLATE=it_IT.cp1252 failed
3: Setting LC_TIME=it_IT.cp1252 failed
4: Setting LC_MONETARY=it_IT.cp1252 failed
Carico il pacchetto richiesto: caret
Carico il pacchetto richiesto: lattice
Carico il pacchetto richiesto: ggplot2
Error in `$<-.data.frame`(`*tmp*`, fd, value = integer(0)) :
replacement has 0 rows, data has 11
Calls: $<- -> $<-.data.frame/*
*/
/*
A part is in italian, I'm sorry.
I'm a beginner in grass and R.

R messages are often not very explicit, unfortunately.

Could you provide us with the exact command line you use (If you use the GUI, you can get the command line by clicking the 'Copy' button once you've filled out all the parameters, or in the history of the 'Console' in the Layer manager.) and an extract of the attribute data you feed into the module ?

Moritz

Thanks for the answer.

v.class.mlR segments_map=gbbb@PERMANENT training_map=tainning@PERMANENT train_class_column=fd output_class_column=vote output_prob_column=prob folds=5 partitions=10 tunelength=10 weighting_metric=accuracy

and the same error with this command:

v.class.mlR segments_map=gbbb training_map=tainning train_class_column=class weighting_mode=smv,swv,qbwwv -i

The vector used was elaborated with i.segment.stats module.

An extract is here:

cat area perimeter fd
1 958 208 1.555034
2 24 22 1.945217
3 160 80 1.726846
4 2036 242 1.440904
5 25 26 2.024344
6 222 96 1.68966
7 8435 1012 1.530879

cat type Integer (9-0)
fd type double/real (25-9)
For the training area (tainning), I use a simple vector with numerical categories (named “cate”) and there are 11 features (just for a trying). The type is in integer64 (10)

Il giorno mer 20 nov 2019 alle ore 12:18 Moritz Lennert <mlennert@club.worldonline.be> ha scritto:

On 20/11/19 11:55, Giuseppe Cillis wrote:

Hi,
I’m trying to use this module for classification of an old aerial photos.
After a segmentation (i.segment and i.segment.stats), I would to use a
machine learning approach for the real classification.
I tried with v.class.mIR which use also R.
But there is an error and I don’t know how to solve it:
/Durante l’avvio - Warning messages:
1: Setting LC_CTYPE=it_IT.cp1252 failed
2: Setting LC_COLLATE=it_IT.cp1252 failed
3: Setting LC_TIME=it_IT.cp1252 failed
4: Setting LC_MONETARY=it_IT.cp1252 failed
Carico il pacchetto richiesto: caret
Carico il pacchetto richiesto: lattice
Carico il pacchetto richiesto: ggplot2
Error in $<-.data.frame(*tmp*, fd, value = integer(0)) :
replacement has 0 rows, data has 11
Calls: $<- → $<-.data.frame/

/
/

A part is in italian, I’m sorry.
I’m a beginner in grass and R.

R messages are often not very explicit, unfortunately.

Could you provide us with the exact command line you use (If you use the
GUI, you can get the command line by clicking the ‘Copy’ button once
you’ve filled out all the parameters, or in the history of the ‘Console’
in the Layer manager.) and an extract of the attribute data you feed
into the module ?

Moritz

No one can help me?
GC

Il giorno mer 20 nov 2019 alle ore 14:06 Giuseppe Cillis <giucillis@gmail.com> ha scritto:

Thanks for the answer.

v.class.mlR segments_map=gbbb@PERMANENT training_map=tainning@PERMANENT train_class_column=fd output_class_column=vote output_prob_column=prob folds=5 partitions=10 tunelength=10 weighting_metric=accuracy

and the same error with this command:

v.class.mlR segments_map=gbbb training_map=tainning train_class_column=class weighting_mode=smv,swv,qbwwv -i

The vector used was elaborated with i.segment.stats module.

An extract is here:

cat area perimeter fd
1 958 208 1.555034
2 24 22 1.945217
3 160 80 1.726846
4 2036 242 1.440904
5 25 26 2.024344
6 222 96 1.68966
7 8435 1012 1.530879

cat type Integer (9-0)
fd type double/real (25-9)
For the training area (tainning), I use a simple vector with numerical categories (named “cate”) and there are 11 features (just for a trying). The type is in integer64 (10)

Il giorno mer 20 nov 2019 alle ore 12:18 Moritz Lennert <mlennert@club.worldonline.be> ha scritto:

On 20/11/19 11:55, Giuseppe Cillis wrote:

Hi,
I’m trying to use this module for classification of an old aerial photos.
After a segmentation (i.segment and i.segment.stats), I would to use a
machine learning approach for the real classification.
I tried with v.class.mIR which use also R.
But there is an error and I don’t know how to solve it:
/Durante l’avvio - Warning messages:
1: Setting LC_CTYPE=it_IT.cp1252 failed
2: Setting LC_COLLATE=it_IT.cp1252 failed
3: Setting LC_TIME=it_IT.cp1252 failed
4: Setting LC_MONETARY=it_IT.cp1252 failed
Carico il pacchetto richiesto: caret
Carico il pacchetto richiesto: lattice
Carico il pacchetto richiesto: ggplot2
Error in $<-.data.frame(*tmp*, fd, value = integer(0)) :
replacement has 0 rows, data has 11
Calls: $<- → $<-.data.frame/

/
/

A part is in italian, I’m sorry.
I’m a beginner in grass and R.

R messages are often not very explicit, unfortunately.

Could you provide us with the exact command line you use (If you use the
GUI, you can get the command line by clicking the ‘Copy’ button once
you’ve filled out all the parameters, or in the history of the ‘Console’
in the Layer manager.) and an extract of the attribute data you feed
into the module ?

Moritz

Sorry for ignoring you up to now, just to much on the platter right now.

Would it be feasible for you to make the data available, privately if necessary ? The easiest (and lightest) would be just the csv output of v.db.select on the training_map and the segments_maps.

Moritz

On 2/12/19 16:31, Giuseppe Cillis wrote:

No one can help me?
GC

Il giorno mer 20 nov 2019 alle ore 14:06 Giuseppe Cillis <giucillis@gmail.com <mailto:giucillis@gmail.com>> ha scritto:

    Thanks for the answer._
    _
    _v.class.mlR segments_map=gbbb@PERMANENT
    training_map=tainning@PERMANENT train_class_column=fd
    output_class_column=vote output_prob_column=prob folds=5
    partitions=10 tunelength=10 weighting_metric=accuracy_

    _and the same error with this command:
    _
    _v.class.mlR segments_map=gbbb training_map=tainning
    train_class_column=class weighting_mode=smv,swv,qbwwv -i_

    The vector used was elaborated with i.segment.stats module.
    An extract is here:
    cat area perimeter fd
    1 958 208 1.555034
    2 24 22 1.945217
    3 160 80 1.726846
    4 2036 242 1.440904
    5 25 26 2.024344
    6 222 96 1.68966
    7 8435 1012 1.530879

    /cat /type Integer (9-0)
    /fd /type double/real (25-9)
    For the training area (t/ainning/), I use a simple vector with
    numerical categories (named/"cate"/) and there are 11 features (just
    for a trying). The type is in integer64 (10)

    Il giorno mer 20 nov 2019 alle ore 12:18 Moritz Lennert
    <mlennert@club.worldonline.be <mailto:mlennert@club.worldonline.be>>
    ha scritto:

        On 20/11/19 11:55, Giuseppe Cillis wrote:
         > Hi,
         > I'm trying to use this module for classification of an old
        aerial photos.
         > After a segmentation (i.segment and i.segment.stats), I would
        to use a
         > machine learning approach for the real classification.
         > I tried with v.class.mIR which use also R.
         > But there is an error and I don't know how to solve it:
         > */Durante l'avvio - Warning messages:
         > 1: Setting LC_CTYPE=it_IT.cp1252 failed
         > 2: Setting LC_COLLATE=it_IT.cp1252 failed
         > 3: Setting LC_TIME=it_IT.cp1252 failed
         > 4: Setting LC_MONETARY=it_IT.cp1252 failed
         > Carico il pacchetto richiesto: caret
         > Carico il pacchetto richiesto: lattice
         > Carico il pacchetto richiesto: ggplot2
         > Error in `$<-.data.frame`(`*tmp*`, fd, value = integer(0)) :
         > replacement has 0 rows, data has 11
         > Calls: $<- -> $<-.data.frame/*
         > */
         > /*
         > A part is in italian, I'm sorry.
         > I'm a beginner in grass and R.

        R messages are often not very explicit, unfortunately.

        Could you provide us with the exact command line you use (If you
        use the
        GUI, you can get the command line by clicking the 'Copy' button
        once
        you've filled out all the parameters, or in the history of the
        'Console'
        in the Layer manager.) and an extract of the attribute data you
        feed
        into the module ?

        Moritz

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

[Guisseppe sent me the files].

The issue is your training file.

As the manual page states:

"The user provides a set of objects (or segments) to be classified, including all feature variables describing these object, and a set of objects to be used as training data, including the same feature variables as those describing the unknown objects, plus one additional column indicating the class each training falls into. The training data can, but does not have to be, a subset of the set of objects to be classified."

IOW, the training data file has to contain the same feature variables as the data you wish to classify.

Your data is:

$ head -1 segmentation_map.csv
cat,area,perimeter,compact_circle,fd

$ head -1 training_map.csv
cat,id,cate

i.e. you training data only includes the id and the class, but not the variables describing the objects.

The reason this is organised in this manner is that you might have training data which is independent of the data you wish to classify, i.e. the ids of the training data might not be linked to the ids in the object data.

Another issue is that in your command, you do not provide a good name for the column that contains the actual class label in the training data:

v.class.mlR segments_map=gbbb@PERMANENT training_map=tainning@PERMANENT train_class_column=fd [...]

v.class.mlR segments_map=gbbb training_map=tainning train_class_column=class [...]

Your training data does not contain a column 'fd' nor a column 'class'. I suppose that in your data it is the column 'cate'.

Moritz

On 4/12/19 10:38, Moritz Lennert wrote:

Sorry for ignoring you up to now, just to much on the platter right now.

Would it be feasible for you to make the data available, privately if
necessary ? The easiest (and lightest) would be just the csv output of
v.db.select on the training_map and the segments_maps.

Moritz

On 2/12/19 16:31, Giuseppe Cillis wrote:

No one can help me?
GC

Il giorno mer 20 nov 2019 alle ore 14:06 Giuseppe Cillis
<giucillis@gmail.com <mailto:giucillis@gmail.com>> ha scritto:

     Thanks for the answer._
     _
     _v.class.mlR segments_map=gbbb@PERMANENT
     training_map=tainning@PERMANENT train_class_column=fd
     output_class_column=vote output_prob_column=prob folds=5
     partitions=10 tunelength=10 weighting_metric=accuracy_

     _and the same error with this command:
     _
     _v.class.mlR segments_map=gbbb training_map=tainning
     train_class_column=class weighting_mode=smv,swv,qbwwv -i_

     The vector used was elaborated with i.segment.stats module.
     An extract is here:
     cat area perimeter fd
     1 958 208 1.555034
     2 24 22 1.945217
     3 160 80 1.726846
     4 2036 242 1.440904
     5 25 26 2.024344
     6 222 96 1.68966
     7 8435 1012 1.530879

     /cat /type Integer (9-0)
     /fd /type double/real (25-9)
     For the training area (t/ainning/), I use a simple vector with
     numerical categories (named/"cate"/) and there are 11 features (just
     for a trying). The type is in integer64 (10)

     Il giorno mer 20 nov 2019 alle ore 12:18 Moritz Lennert
     <mlennert@club.worldonline.be <mailto:mlennert@club.worldonline.be>>
     ha scritto:

         On 20/11/19 11:55, Giuseppe Cillis wrote:
          > Hi,
          > I'm trying to use this module for classification of an old
         aerial photos.
          > After a segmentation (i.segment and i.segment.stats), I would
         to use a
          > machine learning approach for the real classification.
          > I tried with v.class.mIR which use also R.
          > But there is an error and I don't know how to solve it:
          > */Durante l'avvio - Warning messages:
          > 1: Setting LC_CTYPE=it_IT.cp1252 failed
          > 2: Setting LC_COLLATE=it_IT.cp1252 failed
          > 3: Setting LC_TIME=it_IT.cp1252 failed
          > 4: Setting LC_MONETARY=it_IT.cp1252 failed
          > Carico il pacchetto richiesto: caret
          > Carico il pacchetto richiesto: lattice
          > Carico il pacchetto richiesto: ggplot2
          > Error in `$<-.data.frame`(`*tmp*`, fd, value = integer(0)) :
          > replacement has 0 rows, data has 11
          > Calls: $<- -> $<-.data.frame/*
          > */
          > /*
          > A part is in italian, I'm sorry.
          > I'm a beginner in grass and R.

         R messages are often not very explicit, unfortunately.

         Could you provide us with the exact command line you use (If you
         use the
         GUI, you can get the command line by clicking the 'Copy' button
         once
         you've filled out all the parameters, or in the history of the
         'Console'
         in the Layer manager.) and an extract of the attribute data you
         feed
         into the module ?

         Moritz

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user