2017-11-20 7 views
0

deeplearning4j quickstart 분류 문제를 실행하려고합니다.Deeplearning4J를 실행할 때 DataVec 행렬의 제로 열

Windows 8 64 비트, Oracle JDK 8, IntelliJ 2017.2.5 및 Maven 3.3.9를 사용하고 있습니다.

나는 이전에 나를 괴롭힌 카노 바 문제를 극복했다. 이제 런타임에 새로운 문제가 생겼습니다.

다음은 내가 직접 만든 pom.xml입니다. 예제에 pom.xml을 사용하기 위해 @newOne advice를 사용하지 않았다. 왜냐하면 모듈에 의존하지 않고 처음부터 제거 된 것을 만들 수 있기 때문이다.

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>deeplearning4j.example</groupId> 
    <artifactId>deeplearning4j</artifactId> 
    <version>1.0-SNAPSHOT</version> 

    <properties> 
     <maven.test.skip>false</maven.test.skip> 
     <timestamp>${maven.build.timestamp}</timestamp> 
     <maven.build.timestamp.format>MM-dd-yyyy HH:mm</maven.build.timestamp.format> 
     <timestamp>${maven.build.timestamp}</timestamp> 
     <maven.build.timestamp.format>MM-dd-yyyy HH:mm</maven.build.timestamp.format> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
     <java.version>1.8</java.version> 
     <deeplearning4j.version>0.9.1</deeplearning4j.version> 
     <nd4j.version>0.9.1</nd4j.version> 
    </properties> 

    <dependencies> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-core --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>deeplearning4j-core</artifactId> 
      <version>${deeplearning4j.version}</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-nlp --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>deeplearning4j-nlp</artifactId> 
      <version>${deeplearning4j.version}</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-ui-components --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>deeplearning4j-ui-components</artifactId> 
      <version>${deeplearning4j.version}</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-ui-model --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>deeplearning4j-ui-model</artifactId> 
      <version>${deeplearning4j.version}</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-nearestneighbors-model --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>deeplearning4j-nearestneighbors-model</artifactId> 
      <version>${deeplearning4j.version}</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.nd4j/nd4j-api --> 
     <dependency> 
      <groupId>org.nd4j</groupId> 
      <artifactId>nd4j-native-platform</artifactId> 
      <version>${nd4j.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/deeplearning4j-nn --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>deeplearning4j-nn</artifactId> 
      <version>${deeplearning4j.version}</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/jfree/jfreechart --> 
     <dependency> 
      <groupId>jfree</groupId> 
      <artifactId>jfreechart</artifactId> 
      <version>1.0.13</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.datavec/datavec-api --> 
     <dependency> 
      <groupId>org.datavec</groupId> 
      <artifactId>datavec-api</artifactId> 
      <version>0.9.1</version> 
     </dependency> 
     <!-- https://mvnrepository.com/artifact/org.deeplearning4j/dl4j-test-resources --> 
     <dependency> 
      <groupId>org.deeplearning4j</groupId> 
      <artifactId>dl4j-test-resources</artifactId> 
      <version>0.4.0</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.mockito</groupId> 
      <artifactId>mockito-all</artifactId> 
      <version>1.10.19</version> 
      <scope>test</scope> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-source-plugin</artifactId> 
       <version>3.0.1</version> 
       <executions> 
        <execution> 
         <id>attach-sources</id> 
         <goals> 
          <goal>jar</goal> 
         </goals> 
        </execution> 
        <execution> 
         <id>attach-javadocs</id> 
         <goals> 
          <goal>jar</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.5.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-site-plugin</artifactId> 
       <version>3.4</version> 
       <dependencies> 
        <dependency> 
         <groupId>org.apache.maven.wagon</groupId> 
         <artifactId>wagon-http-lightweight</artifactId> 
         <version>1.0</version> 
        </dependency> 
       </dependencies> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>buildnumber-maven-plugin</artifactId> 
       <version>1.4</version> 
       <executions> 
        <execution> 
         <phase>generate-resources</phase> 
         <goals> 
          <goal>create-metadata</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <attach>true</attach> 
        <!--make it available for jar/war classpath resource --> 
        <addOutputDirectoryToResources>true</addOutputDirectoryToResources> 
        <revisionOnScmFailure>na</revisionOnScmFailure> 
        <doCheck>false</doCheck> 
        <doUpdate>false</doUpdate> 
        <revisionOnScmFailure>true</revisionOnScmFailure> 
        <format>{0,date,yyyy-MM-dd_HH-mm}_{1}</format> 
        <items> 
         <item>timestamp</item> 
         <item>${user.name}</item> 
        </items> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

IntelliJ는 내 Maven 창에 빨간색 표시가 없습니다. 오류 메시지없이 코드를 성공적으로 빌드하고 패키지화 할 수 있습니다. 나는 분류 문제를 실행하면

나는 런타임에이 메시지가 :

나는 열을 0으로이 행렬 과거를 얻을 입력에 조정해야합니까
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
SLF4J: Defaulting to no-operation (NOP) logger implementation 
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
Exception in thread "ADSI prefetch thread" java.lang.RuntimeException: org.nd4j.linalg.exception.ND4JIllegalStateException: Invalid shape: Requested INDArray shape [50, 0] contains dimension size values < 1 (all dimensions must be 1 or more) 
    at org.deeplearning4j.datasets.iterator.AsyncDataSetIterator$AsyncPrefetchThread.run(AsyncDataSetIterator.java:442) 
Caused by: org.nd4j.linalg.exception.ND4JIllegalStateException: Invalid shape: Requested INDArray shape [50, 0] contains dimension size values < 1 (all dimensions must be 1 or more) 
    at org.nd4j.linalg.factory.Nd4j.checkShapeValues(Nd4j.java:5022) 
    at org.nd4j.linalg.factory.Nd4j.create(Nd4j.java:5012) 
    at org.nd4j.linalg.factory.Nd4j.create(Nd4j.java:4965) 
    at org.nd4j.linalg.factory.Nd4j.create(Nd4j.java:4093) 
    at org.deeplearning4j.datasets.datavec.RecordReaderMultiDataSetIterator.convertWritables(RecordReaderMultiDataSetIterator.java:377) 
    at org.deeplearning4j.datasets.datavec.RecordReaderMultiDataSetIterator.convertFeaturesOrLabels(RecordReaderMultiDataSetIterator.java:271) 
    at org.deeplearning4j.datasets.datavec.RecordReaderMultiDataSetIterator.nextMultiDataSet(RecordReaderMultiDataSetIterator.java:234) 
    at org.deeplearning4j.datasets.datavec.RecordReaderMultiDataSetIterator.next(RecordReaderMultiDataSetIterator.java:177) 
    at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:306) 
    at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:393) 
    at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:51) 
    at org.deeplearning4j.datasets.iterator.AsyncDataSetIterator$AsyncPrefetchThread.run(AsyncDataSetIterator.java:423) 

?

+0

어떻게 pom.xml을 볼 수 있습니까? 그 모양은 다음과 같습니다 : https://github.com/deeplearning4j/dl4j-examples/blob/master/pom.xml canova에 직접적으로 의존하지 마십시오. – newOne

+0

고맙습니다. 시도해 보겠습니다. – duffymo

+0

처음부터 수동으로 Maven pom.xml을 설정하기를 원했습니다. 많은 기계류처럼 보이기 때문에 pom.xml 예제를 언급하지 않았습니다. 확실히 간단한 문제를 해결하기 위해 모든 예제 모듈과 Maven pom을 사용할 필요는 없다. 나는 그것이 나의 메이븐 스 스킬에 구멍이 될 수 있음을 인정할 것이다. – duffymo

답변

0

위 게시 한 pom이 작업을 수행했습니다.

다음 호가 데이터와 함께 나타났습니다. 내가 가지고 있던 교육 및 평가 파일은 정확하지 않았습니다. 내가 내 콘솔 창에이 결과를 가지고 올바른 파일을 가지고 일단

는 :

교육 데이터

enter image description here

: 추가 보너스로

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
SLF4J: Defaulting to no-operation (NOP) logger implementation 
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
Evaluate model.... 

Examples labeled as 0 classified by model as 0: 100 times 
Examples labeled as 1 classified by model as 1: 100 times 


==========================Scores======================================== 
# of classes: 2 
Accuracy:  1.0000 
Precision:  1.0000 
Recall:   1.0000 
F1 Score:  1.0000 
======================================================================== 
****************Example finished******************** 

을, 나는 두 사랑스러운 팝업 창을 가지고

평가 데이터

enter image description here

deeplearning4j로 한푼도 내게되어 기쁩니다. 나는 단순화 된 pom.xml이 다른 누군가를 도울 수 있기를 바란다.

잘 했어, deeplearning4j 팀! 나는 더 깊은 다이빙을 고대합니다.