Record Management System从入门到精通系列之一

从jieba分词到BERT-wwm——中文自然语言处理(NLP)基础分享系列(12) 今天是本系列的最后一期,完整代码呈现Huggingface transformers平台上微调BERT-wwm-ext的过程方法。 阅读详情

      Record Management System是J2ME的一个重要的子系统,目的是实现应用程序本地数据的持久性存储。目前支持文件系统的移动信息设备还有限,因此Record Management System是J2ME开发人员实现本地数据存储的首选途径。本文的目的就是全面的介绍Record Management System的知识。

      顾名思义Record Management System是管理数据的系统,Record是系统中最重要的实体。在移动设备存储空间存储的并不是字段,而是字节数组。Mobile Infomation Device Profile(MIDP)规范中并没有规定什么样的数据才能存储为记录,事实上记录是任何可以被字节数组表示的数据,例如图片、文本等。Record Management System的职责是存储和唯一标识记录,而表示数据的任务是由应用程序来完成的,因此J2ME的开发人员往往要花费更多的精力来处理存储空间中的数据。这样做的目的是简化MIDP的实现,使得J2ME的子系统尽量的小巧、灵活。毕竟移动信息设备的存储空间和处理器的能力都有限。

      Record Store是一系列记录的有序集合,记录是不能单独存在的,必须属于Record Store。Record Store保证记录的读写操作都是原子的,数据不会被破坏。在API中Record Store是由javax.microedition.rms.RecordStore实现的,关于RecordStore的具体操作在接下来的文章中会有详细的介绍。

      MIDP规范中说明移动信息设备要提供至少8K的非易失性存储空间给应用程序来实现数据的持久性存储。但是不同的设备提供的空间并不相同。如果MIDlet suite使用了Record Management System,那么它必须在MANIFEST文件和JAD文件中通过设置MIDlet-Data-Size来说明它所需要的最小的数据存储空间,单位是字节,例如MIDlet-Data-Size:8192。如果你的值超过了移动设备规定的最大值那么你的应用程序将不能正确安装。这个值并不是移动设备真正提供给应用程序的最大Record Management System的存储空间,往往要大一些,因此开发人员应该避免把应用程序需要的最小存储空间设置的过大,必要的时候应该参考相关设备的说明手册。在非易失性存储空间内读写数据往往速度会比较慢,因此针对频繁访问的数据最好提供缓存的机制来提供性能。Record Management System的读写操作是线程安全的,但是由于Record Store是被整个MIDlet suite共享的,所以如果不同MIDlet上运行的线程操作Record Store的时候,我们应该进行必要的线程同步,避免数据被破坏。

      MIDP1.0和MIDP2.0中关于Record Management System的实现有些不同,在同一个MIDlet suite里面的MIDlets可以相互访问彼此的Record Store。但是在MIDP1.0的实现中,并没有提供在不同MIDlet suite之间共享Record Store的机制。在MIDP2.0中提供的了新的API来解决不同MIDlet suite之间共享Record Store的问题,在创建Record Store的时候通过授权模式和读写控制参数来进行共享机制的管理,我将在下篇文章中进行详细的介绍。

      加强对Record Management System的理解的最好的办法就是进行实际的开发,在进行开发中我发现并不是所有移动设备的MIDP实现都准确无误。当我用getSizeAvaliable()方法查询Nokia6108的可用Record Store空间的时候得到的数值是超过1M字节,但是当我写入40K的数据的时候就出现了RecordStoreFullException异常,因此我编写了一个自动测试手机Record Store最大存储空间的软件。原理是每隔一定时间例如100-500毫秒向Record Store内写入1K字节的数据,当抛出存储空间已满的异常的时候就可以得到最大值了,精确单位为K字节。下面是程序的源代码和JAD文件的内容,开发平台为Eclipse3.0RC2+EclipseME0.4.1+Wtk2.1+J2SDK1.4.2._03,在真机Nokia 6108上测试通过并显示最大值为31K。(请不要在模拟器上进行测试,那样结果没有意义)

      总结:本文只是带领读者对Record Management System进行了大概的了解,虽然在文章最后提供了一个应用程序。但是并没有深入分析如何使用Record Management System。在接下来的文章中我们会深入分析javax.microedition.rms包中的类,重点是如何使用RecordStore类。

//RMSAnalyzer.java
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.RecordStoreException;

/*
 * Created on 2004-6-21
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author ming
 *
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class RMSAnalyzer extends MIDlet
{

    private Display display;
    private CounterCanvas counterCanvas;
    private Alert alert;

    /*
     * (non-Javadoc)
     *
     * @see javax.microedition.midlet.MIDlet#startApp()
     */
    protected void startApp() throws MIDletStateChangeException
    {
        // TODO Auto-generated method stub

        display = Display.getDisplay(RMSAnalyzer.this);
        alert = new Alert("错误提示");
        try
        {
            String interval = this.getAppProperty("INTER");
            int t = Integer.parseInt(interval);
            counterCanvas = new CounterCanvas(t, 1, this);
        }
        catch (RecordStoreException e)
        {
            this.showAlertError(e.getMessage());
        }
        display.setCurrent(counterCanvas);

    }
   
    public Display getDisplay()
    {
        return display;
    }

    /*
     * (non-Javadoc)
     *
     * @see javax.microedition.midlet.MIDlet#pauseApp()
     */
    protected void pauseApp()
    {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     *
     * @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
     */
    protected void destroyApp(boolean arg0) throws MIDletStateChangeException
    {
        // TODO Auto-generated method stub

    }

    public void showAlertError(String message)
    {
        alert.setString(message);
        alert.setType(AlertType.ERROR);
        alert.setTimeout(3000);
        display.setCurrent(alert);

    }

}

//CounterCanvas.java
import java.util.Timer;
import java.util.TimerTask;

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.*;

/*
 * Created on 2004-6-21
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author ming
 *
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class CounterCanvas extends Canvas implements CommandListener
{

    private RMSModel model;
    private RMSAnalyzer RMSanalyzer;
    private int interTime;
    private int counter;
    private boolean go = true;
    public static Command backCommand = new Command("退出", Command.EXIT, 3);
    public static final int INC = 1;
    public final Timer timer = new Timer();

    public CounterCanvas(int interTime, int base, RMSAnalyzer rmsa)
            throws RecordStoreException
    {
        this.interTime = interTime;
        this.counter = base;
        this.RMSanalyzer = rmsa;
        model = new RMSModel(base, RMSanalyzer);
        this.addCommand(backCommand);
        this.setCommandListener(this);

        TimerTask timerTask = new TimerTask()
        {
            public void run()
            {

                try
                {
                    model.writeRecord(INC);
                    counter++;
                } catch (RecordStoreFullException e)
                {
                    go = false;
                    model.deleteRMS();
                    timer.cancel();
                } catch (RecordStoreException e)
                {
                    model.deleteRMS();
                    RMSanalyzer.showAlertError(e.getMessage());
                    timer.cancel();
                }
                repaint();

            }
        };

        timer.schedule(timerTask, 1000, interTime);

    }

    /**
     * @param counter
     *            The counter to set.
     */
    public void setCounter(int counter)
    {
        this.counter = counter;
    }

    /**
     * @param interTime
     *            The interTime to set.
     */
    public void setInterTime(int interTime)
    {
        this.interTime = interTime;
    }

    /*
     * (non-Javadoc)
     *
     * @see javax.microedition.lcdui.Displayable#paint(javax.microedition.lcdui.Graphics)
     */
    protected void paint(Graphics arg0)
    {
        // TODO Auto-generated method stub
        int SCREEN_WIDTH = this.getWidth();
        int SCREEN_HEIGHT = this.getHeight();
        arg0.drawRect(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 2,
                SCREEN_WIDTH * 4 / 5, 10);
        if(RMSanalyzer.getDisplay().isColor())
        {
            arg0.setColor(128, 128, 255);
        }
        arg0.fillRect(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 2, counter, 10);
        if (!go)
            arg0.drawString("最大值:" + counter+"K字节", 0, 0, Graphics.TOP
                    | Graphics.LEFT);

    }

    /*
     * (non-Javadoc)
     *
     * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command,
     *      javax.microedition.lcdui.Displayable)
     */
    public void commandAction(Command arg0, Displayable arg1)
    {
        // TODO Auto-generated method stub
        if (arg0 == backCommand)
        {
            try
            {
                model.deleteRMS();
                RMSanalyzer.destroyApp(false);
                RMSanalyzer.notifyDestroyed();
            } catch (MIDletStateChangeException e)
            {

            }
        }

    }

}

//RMSModel.java

import javax.microedition.rms.*;

/**
 * @author ming
 *
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class RMSModel
{
    public static final int K = 1024;
    private RecordStore rs;
    private int baseCount;
    private RMSAnalyzer RMSanalyzer;
    public static final String name = "test";

    public RMSModel(int baseCount, RMSAnalyzer rmsa)
            throws RecordStoreException
    {
        this.baseCount = baseCount;
        this.RMSanalyzer = rmsa;
        if (rs == null)
        {
            rs = RecordStore.openRecordStore(name, true);
            writeRecord(baseCount);
        }
    }

    public void writeRecord(int count) throws RecordStoreException
    {
        byte[] data = new byte[count * K];
        for (int i = 0; i < count; i++)
        {
            data[i] = 1;
        }
        rs.addRecord(data, 0, count * K);
    }

    public void deleteRMS()
    {
        try
        {
            rs.closeRecordStore();
            RecordStore.deleteRecordStore(name);
        } catch (RecordStoreException e)
        {
            RMSanalyzer.showAlertError(e.getMessage());
        }
    }
}

RMSAnalyzer.jad

MIDlet-Jar-Size: 5293
MIDlet-1: RMSAnalyzer,,RMSAnalyzer
MIDlet-Jar-URL: RMSAnalyzer.jar
MicroEdition-Configuration: CLDC-1.0
MIDlet-Version: 1.0.0
MIDlet-Name: RMSAnalyzer
MIDlet-Data-Size: 8192
MIDlet-Vendor: Midlet Suite Vendor
MicroEdition-Profile: MIDP-1.0
INTER: 100

 

基于四旋翼模型的火箭型无人机视线角保持控制仿真设计 本文针对火箭型无人机的视线角保持控制问题展开研究。基于四旋翼动力学模型,通过改造设计了一种摄像头朝上安装的特殊无人机系统,用于追踪空中目标。文章详细推导了坐标系定义、运动学和动力学方程,重点分析了摄像头安装与视线几何关系,建立了目标运动模型和视线向量计算方法。通过解算期望姿态角,实现了使机体Z轴始终对准目标的控制目标。仿真结果表明,该系统能有效完成视线角保持任务,为空对空监视等应用场景提供了可行方案。~~~~~ 阅读详情

相关推荐

ML307A模组通过MQTT协议接入OneNET平台的AT指令全解析

本文详细解析了ML307A模组通过MQTT协议接入OneNET平台的完整AT指令流程。从平台侧的产品创建、设备添加,到核心难点连接密钥的计算方法,再到模组侧的基础网络附着、MQTT连接配置、数据收发及调试排错,提供了手把手的实战指南,帮助开发者快速实现物联网设备上云。

weixin_29240711的博客 490

Record Management System 从入门到精通系列之四

      本文将主要讲述RecordFilter和RecordEnumeration的用法,这在整个Record Management System中都是至关重要的。由于本人觉得RecordComparator和RecordFilter类似并且用出相对小些,因此不再这里做介绍了。我们依然是通过一个示范的应用程序说明如何使用这两个接口。       RecordFilter的定义非常的简单,他只定

mingjava的专栏 3026

GitHub 新手使用手册

理论说太多容易忘,来实践实践吧。

2501_90226046的博客 1052

landashu/easyai-plus AI智能体创建与配置完全指南

在当今AI技术快速发展的时代,企业面临着如何高效利用AI能力的挑战。传统的AI应用往往存在配置复杂、集成困难、维护成本高等问题。easyai-plus通过AI智能体(AI Agent)技术,为企业提供了一站式的AI能力管理和配置解决方案。 通过本文,您将掌握: - ✅ AI智能体的核心概念与架构设计 - ✅ 智能体创建与配置的完整流程 - ✅ 多模型集成与工具链配置技巧 - ✅ Agent协同...

gitblog_00576的博客 476

别再让信号‘撞墙’了!手把手教你用嘉立创阻抗计算器搞定PCB高速线(附免费压层结构选择)

本文详细介绍了如何使用嘉立创阻抗计算器解决PCB高速线设计中的阻抗匹配问题,避免信号反射和传输损耗。通过免费压层结构选择和五步计算法,帮助工程师快速掌握USB3.0差分线等高速信号的设计技巧,提升PCB设计效率和信号质量。

weixin_30736301的博客 278

Ardupilot环境搭建

Ardpilot介绍:ArduPilot通过多种传感器的数据(GPS、加速度计、气压计、磁场计)等来估计飞行器的姿态,从而使飞行器能够保持稳定。

weixin_62387234的博客 2633

Springboot整合ollama运行本地AI大模型

msg=这里写上你要问的问题例如: http://localhost:8080/ollama/chat/msg?msg=你好这样就是使用最简单的方式使用Springboot整合了ollama的本地AI大模型了。

m0_65324703的博客 877

《哥谭神话-工程篇》02.Palantir的Ontology层(语义层) -企业操作系统的大脑

Ontology(语义层) 是Foundry 的核心层。Ontology 位于集成到 Foundry 中的数字资产(数据集和模型)之上,并将其连接到现实世界的对应物,从工厂、设备和产品等物理资产到客户订单或金融交易等概念。本篇将详细拆解Ontology(语义层)。

880

使用Android中数据库来模拟MIDP中的RMS

 废话不说了,直接列代码。虽然不是很完整,给大家参考一下吧。 package JavaME.rms;import java.io.File;import JavaME.midlet.MIDlet;import android.content.ContentValues;import android.database.Cursor;import android.database.sqlite

灯心草的专栏 2007

[Dify实战] 项目复盘助手:自动拉数据、生成复盘报告

本文介绍如何利用Dify平台构建自动化项目复盘助手,解决传统人工复盘效率低、易遗漏等问题。系统通过自动拉取Git/Jira等数据源,计算关键指标后,由LLM生成结构化复盘报告。文章详细讲解了数据采集、指标计算、Prompt设计等核心模块的实现,并分享了完整Workflow搭建步骤。实践表明,该系统能将复盘耗时从4小时缩短至10分钟,显著提升数据准确率和执行频率。最后总结了数据一致性、输出质量等常见问题的解决方案,强调Dify+LLM组合可实现复盘流程的自动化流水线。

技术小甜甜:传播可落地技术,帮助个人和企业降低解决真实场景问题的成本 117

124、LLC谐振变换器的矩阵变压器设计

摘要 本文分享了LLC谐振变换器中矩阵变压器的实战设计经验。针对大功率LLC单颗变压器的痛点(绕组层数多、散热不均、漏感一致性差),作者提出将大变压器拆分为多个小变压器单元(建议6个),通过原边串联、副边并联的方式实现功率分配。详细解析了磁芯选型、匝比计算、绕组结构、漏感控制和散热设计等关键参数,特别强调了小磁芯优势、等效匝比计算误区以及三明治绕法的重要性。文中还总结了调试过程中的谐振频率偏移和均流问题解决方案,并给出了矩阵数量选择、磁芯材质、绝缘材料等实用建议。作者指出,矩阵变压器在2kW以上LLC应用中

Jack010169的博客 169

实时调度算法RMS简介

在每个调度周期内,RT-VMM 按照优先级顺序执行 RTVMs,直到它们耗尽了分配的 CPU 时间或者当前调度周期结束。在实时虚拟化技术中,RMS被用于实时虚拟机 (RTVM) 的调度,以确保它们满足时间约束。每个 RTVM 被分配一个固定的 CPU 带宽,表示为该 RTVM 在每个调度周期内可以运行的时间。在 RMS 中,每个 RTVM 被视为一个周期性任务,其周期等于该 RTVM 的调度周期。通过使用 RMS 算法,实时虚拟化技术可以确保满足 RTVMs 的时间约束,同时提供了可预测的调度行为。

望获实时Linux系统 2079

Airtest进阶使用篇-提高脚本稳定性+批量运行脚本

Airtest进阶篇,主要分享如何提高脚本稳定性+如何批量运行脚本生成测试报告!

程序员小杨哥的博客 2569

Record Management System从入门到精通系列之二

      在系列之一中,我们着重讲述了Record Management System的基础知识。在介绍如何使用Record Management System之前,我想首先介绍一下Java IO以及在J2ME平台实现序列化的内容,无论对Record Management System还是MIDP中的通用联网框架来说,上述内容都是非常重要的。       在CLDC中定义的Java IO是非常短

mingjava的专栏 2718

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Record Management System从入门到精通系列之三

   前面两篇文章详细的介绍了Record Management System的基本概念以及对象序列化的问题,现在我们主要介绍关于RecordStore类的使用,在SUN的网站提供了一个RMSAnalyzer类,你可以把他用在你的项目中来调试你的程序。 Record Store Discovery       你可以通过调用RecordStore.listRecordStores()来得到MIDl

mingjava的专栏 3350

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

初识RMS(Record Management System)

转载自http://kenter1643.iteye.com/blog/109080 初识RMS(Record Management System) 关键字: RMS 记得曾经有人说,数据库程序员是世界上最不愁找不到工作的职业了。虽然此话无从考究J,不过也从一个方面说明了不论开发什么类型的应用,数据库几乎是一个永恒的话题!在java的体系结构里,我们现在已经有了JDBC这个技术,还有许...

duck991的专栏 680

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

RMS(Record Management System)

RMS(Record Management System)是MIDP中一个非常重要的子系统,因为它是J2ME应用程序进行持久性存储的唯一途径。当然你的系统如果支持JSR75的话,那么你可以使用FileConnection来对文件进行操作。在这个包里面总共包括四个接口、一个类和五个异常。由此可见RMS设计的非常小巧,这正是为了满足移动信息设备资源受限的需求。<br /><br />五个问题<br /><br />1,什么是持久性存储<br /><br />持久性存储简单的理解就是数据不因为程序的退出而丢失,一

jacky choise 1153

RMS从入门到精通之三

在系列之一中,我们着重讲述了Record Management System的基础知识。在介绍如何使用Record Management System之前,我想首先介绍一下Java IO以及在J2ME平台实现序列化的内容,无论对Record Management System还是MIDP中的通用联网框架来说,上述内容都是非常重要的。    在CLDC中定义的Java IO是非常短小精悍的,但是

aflylove的专栏 855

RMS从入门到精通之一

 Record Management System是J2ME的一个重要的子系统,目的是实现应用程序本地数据的持久性存储。目前支持文件系统的移动信息设备还有限,因此Record Management System是J2ME开发人员实现本地数据存储的首选途径。本文的目的就是全面的介绍Record Management System的知识。      顾名思义Record Management Syst

!Java 2509

[转载]RMS从入门到精通之三

RMS从入门到精通之三前面两篇文章详细的介绍了Record Management System的基本概念以及对象序列化的问题,现在我们主要介绍关于RecordStore类的使用,在SUN的网站提供了一个RMSAnalyzer类,...

congji3817的博客 281

RMS从入门到精通

Record Management System是J2ME的一个重要的子系统,目的是实现应用程序本地数据的持久性存储。目前支持文件系统的移动信息设备还有限,因此Record Management System是J2ME开发人员实现本地数据存储的首选途径。本文的目的就是全面的介绍Record Management System的知识。      顾名思义Record Management Syste

Stone的专栏 2156

RMS从入门到精通之二

RMS从入门到精通之二 By  Michael1116 发表于 2006-6-26 20:23:00  作者:mingjava  文章来源:http://www.j2medev.

大西瓜 447

[转载]RMS从入门到精通之二

RMS从入门到精通之二在系列之一中,我们着重讲述了Record Management System的基础知识。在介绍如何使用Record Management System之前,我想首先介绍一下Java IO以及在J2ME平台实...

congji3817的博客 105

RMS从入门到精通之四

   本文将主要讲述RecordFilter和RecordEnumeration的用法,这在整个Record Management System中都是至关重要的。由于本人觉得RecordComparator和RecordFilter类似并且用出相对小些,因此不再这里做介绍了。我们依然是通过一个示范的应用程序说明如何使用这两个接口。      RecordFilter的定义非常的简单,他只定义了一个

!Java 2291
下一篇: Java学习资源推荐(书籍和网站)
mingjava
博客等级 码龄24年 68粉丝 114原创
评论 7
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值