IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

avec Java Discussion :

wrong input data type


Sujet :

avec Java

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    8
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 8
    Points : 5
    Points
    5
    Par défaut wrong input data type
    Bonsoir à vous!

    j'ai le code suivant, qui est sensé faire une analyse en composantes principales de mon fichier .csv. Pour cela, j'utilise opencsv et
    javastat.multivariate.PCA. Le problème est qu'alors que j'ai à peine retoucher le code fournis sur cette page, qui contenait aussi des erreurs, en specifiant le type des variables pPrincipalComponent et vVariable, il me met:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    Exception in thread "main" java.lang.IllegalArgumentException: Wrong input data type.
    	at javastat.util.DataManager.castDoubleObject(DataManager.java:3121)
    	at javastat.multivariate.PCA.principalComponents(PCA.java:424)
    	at pca.Apply2.main(Apply2.java:34)
    Qu'est-ce que j'ai mal fait? J'ai tout mis en double puisque PCA n'utilise que ça. Je ne comprend pas, pourriez-vous m'aider, s'il vous plait?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    package pca;
     
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.*;
    import java.lang.Object;
    import javastat.multivariate.PCA;
    import javastat.StatisticalAnalysis;
    import au.com.bytecode.opencsv.CSVReader;
     
    public class Apply2 {
     
    	public static void main(String[] args) throws IOException 
        {
            CSVReader reader = new CSVReader(new 
                    FileReader("stockori/genotype.csv"));
            String [] nextLine;
            double[][] myTable= new double[697][149];
            while ((nextLine = reader.readNext()) != null) 
            {
                // nextLine[] is an array of values from the line
            	int j=0;
                for (int i=0; i<nextLine.length; i++)
                {
                    myTable[j][i]=Double.parseDouble(nextLine[i]);
                }
                j++;
            }
            System.out.println(myTable.length);
     
            Hashtable argument2 = new Hashtable(); 
            PCA testclass4 = new PCA(argument2, null); 
            double[][]pPrincipalComponents= testclass4.principalComponents(argument2, myTable); 
            double[] vVariance = testclass4.variance(argument2, myTable);
        }
     
    }

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 106
    Points : 121
    Points
    121
    Par défaut
    Et si dans ta boucle while, tu enlevais le "int j=0" et tu le mettais juste avant ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    package pca;
     
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.*;
    import java.lang.Object;
    import javastat.multivariate.PCA;
    import javastat.StatisticalAnalysis;
    import au.com.bytecode.opencsv.CSVReader;
     
    public class Apply2 {
    	
    	public static void main(String[] args) throws IOException 
        {
            CSVReader reader = new CSVReader(new 
                    FileReader("stockori/genotype.csv"));
            String [] nextLine;
            double[][] myTable= new double[697][149];
            int j=0;
            while ((nextLine = reader.readNext()) != null) 
            {
                // nextLine[] is an array of values from the line
                for (int i=0; i<nextLine.length; i++)
                {
                    myTable[j][i]=Double.parseDouble(nextLine[i]);
                }
                j++;
            }
            System.out.println(myTable.length);
                    
            Hashtable argument2 = new Hashtable(); 
            PCA testclass4 = new PCA(argument2, null); 
            double[][]pPrincipalComponents= testclass4.principalComponents(argument2, myTable); 
            double[] vVariance = testclass4.variance(argument2, myTable);
        }
     
    }

Discussions similaires

  1. Réponses: 1
    Dernier message: 24/03/2009, 09h04
  2. Réponses: 6
    Dernier message: 12/05/2008, 14h56
  3. datetime data type resulted in an out-of-range
    Par faamugol dans le forum ASP
    Réponses: 2
    Dernier message: 26/05/2004, 20h51
  4. chemin d'un input de type file
    Par sbbn1 dans le forum ASP
    Réponses: 2
    Dernier message: 05/04/2004, 20h19
  5. [SQL Server] Error converting data type varchar...
    Par Sir Tengu dans le forum MS SQL Server
    Réponses: 9
    Dernier message: 13/06/2003, 10h46

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo