本篇內(nèi)容介紹了“StatsListener怎么使用”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
公司主營業(yè)務(wù):成都網(wǎng)站建設(shè)、做網(wǎng)站、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出中山免費做網(wǎng)站回饋大家。
import org.deeplearning4j.api.storage.StatsStorage; import org.deeplearning4j.examples.userInterface.util.UIExampleUtils; import org.deeplearning4j.nn.multilayer.MultiLayerNetwork; import org.deeplearning4j.optimize.listeners.ScoreIterationListener; import org.deeplearning4j.ui.api.UIServer; import org.deeplearning4j.ui.stats.StatsListener; import org.deeplearning4j.ui.storage.FileStatsStorage; import org.nd4j.linalg.dataset.api.iterator.DataSetIterator; import java.io.File; /** * A version of UIStorageExample showing how to saved network training data to a file, and then * reload it later, to display in in the UI * * @author Alex Black */ public class UIStorageExample { public static void main(String[] args){ //Run this example twice - once with collectStats = true, and then again with collectStats = false boolean collectStats = true; if(collectStats){ //First run: Collect training stats from the network //Note that we don't have to actually plot it when we collect it - though we can do that too, if required MultiLayerNetwork net = UIExampleUtils.getMnistNetwork(); DataSetIterator trainData = UIExampleUtils.getMnistData(); StatsStorage statsStorage = new FileStatsStorage(new File(System.getProperty("java.io.tmpdir"), "ui-stats.dl4j")); net.setListeners(new StatsListener(statsStorage), new ScoreIterationListener(10)); net.fit(trainData); System.out.println("Done"); } else { //Second run: Load the saved stats and visualize. Go to http://localhost:9000/train StatsStorage statsStorage = new FileStatsStorage(new File(System.getProperty("java.io.tmpdir"), "ui-stats.dl4j")); UIServer uiServer = UIServer.getInstance(); uiServer.attach(statsStorage); } } }
“StatsListener怎么使用”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!