SpringBoot学习笔记(第一课时:项目建立)

建立SpringBoot+MyBatis的项目       为实现项目的快速高效地开发,采取合适的框架尤为重要。利用SpringBoot+Mybatis框架可以达到快速高效开发的目的。而对于初学者,如何建立一个这样的项目呢?      今天我就从最简单的项目建立开始讲起。      首先希望你的开发者工具跟我一样也是idea,这样也许你能避免许多问题,因为在Eclipse中创建项目有着些许不同。但你如果有足够的经验,这些问题并不能阻碍你,我会在... 阅读详情

SpringBoot学习笔记(第一课时)

目录

一、前置知识注意

  • 熟悉利用maven构建项目
  • 了解Sping注解
  • 了解RESTful API
  • 不需要去学SpringMVC
  • 版本问题

二、初识SpringBoot

1、特点

  1. 化繁为简,简化配置
  2. 使用量多,备受欢迎
  3. 入门级微框架

2、开发环境

  • java jdk:终端查看版本:java -version
  • maven环境: 命令:mvn -verision

3、软件

使用IntelliJ IDEA,也可以使用Eclipse。旗舰版收费问题:使用学生账号注册,即可使用到你毕业。社区版也应该没有多大的问题。

4、新建项目

1) IDEA建立SpringBoot项目
  1. file -> new -> project ->Spring Initializr,完成
    在这里插入图片描述
  2. 填写相关内容(不要用拼音)
    在这里插入图片描述
  3. SpringBoot版本选择
    在这里插入图片描述
  4. 选择项目路径,下一步完成,不要有空格(目录不存在会提示你创建目录)
    在这里插入图片描述

注意:在下载配置文件的时候会灰常的慢,因为使用的是maven默认的镜像地址,我们改用阿里的就行,当然,科学上网的你就随意了。

下面我们修改maven镜像地址的配置,win:maven安装目录\conf 例如:D:\wamp\maven3.6.3\conf,我们修改这个目录下的settings.xml(个人建议先拷贝一个出来,原来的重新命名为settings.default.xml,复制下面的就用原来的settings.xml,保存),然后我们回到项目目录下,如下图操作
在这里插入图片描述
setting.xml

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.home}/conf/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |-->
  <pluginGroups>
    <!-- pluginGroup
     | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
  </pluginGroups>

  <!-- proxies
   | This is a list of proxies which can be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when connecting to a particular server, identified by
     | a unique name within the system (referred to by the 'id' attribute below).
     |
     | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
     |       used together.
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->

  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
    <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are intended to provide local machine-
   | specific paths and repository locations which allow the build to work in the local environment.
   |
   | For example, if you have an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that the variable is
   | dereferenced during the build process to configure the cactus plugin.
   |
   | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
   | section of this document (settings.xml) - will be discussed later. Another way essentially
   | relies on the detection of a system property, either matching a particular value for the property,
   | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
   |       repositories, plugin repositories, and free-form properties to be used as configuration
   |       variables for plugins in the POM.
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
     | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
     | might hypothetically look like:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

当然,我们也可以使用在线工具,然后再解压在eclipse中引用:
Spring Initializr

在这里插入图片描述

2) eclipse建立SpringBoot项目
  1. file(文件) -> new(新建) -> project(项目) -> maven -> maven project,然后,下一步:
    在这里插入图片描述
  2. 这一步默认就ok,下一步
    在这里插入图片描述
  3. 选择ora.apache.maven.archetypes maven-archetype-quickstart 1.1 然后下一步在这里插入图片描述
  4. 设置group id 和 artifact id ,其他默认就好,然后下一步完成
    在这里插入图片描述
    项目目录结构
    在这里插入图片描述

那么这一个课时我就学完了。

参考 Maven镜像地址大全,Maven镜像地址配置示例

第一个SpringBoot项目的创建 来,让我们一起创建第一个springboot项目😁 阅读详情

相关推荐

Spring boot创建第一个项目

8080端口通常用于部署Web应用程序,特别是在开发和测试阶段。在Tomcat中,默认情况下,Web应用程序会使用8080端口来监听HTTP请求。这意味着当您启动Tomcat服务器时,您可以通过访问http://localhost:8080来访问部署在Tomcat上的Web应用程序。

ltzoro的博客 1505

声明 LICENSE 的方法

Apache-2.0,我们可以将其称之为开源许可证,那么到底开源 许可证是什么呢? 开源许可证即授权条款。开源软件并非完全没有限制。最基本的限制, 就是开源软件强迫任何使用和修改该软件的人承认发起人的著作权和所 有参与人的贡献。任何人拥有可以自由复制、修改、使用这些源代码的 权利,不得设置针对任何人或团体领域的限制;不得限制开源软件的商 业使用等。而许可证就是这样一个保证这些限制的法律文件。 示例: elasticsearch Public License Version 2.0 D

开心就好 9629

两种方式建立SpringBoot项目

一、子工程通过继承spring-boot-starter-parent父工程 1、子项目pom <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <v...

xxwd12的博客 253

Java nio

注:本章只对其中一些内容进行

愿君出走半生,归来时仍是少年 1816

【Spring Boot】SpringBoot快速入门: 创建你的第一个SpringBoot项目

本篇博客指导你快速入门Spring Boot并创建你的第一个项目。我们详细介绍了Spring Boot项目的创建,结构解析,如何创建RESTful API,如何添加数据库模型,以及如何运行和测试项目。无论你是新手还是有经验的开发者,本篇博客都能帮你掌握Spring Boot的基本操作,为你的Spring Boot学习之旅打下坚实的基础。

Ricky的博客 3225

【SpringBoot】1、创建第一个SpringBoot项目

创建SpringBoot项目可以通过两种方式,1、通过访问:https://start.spring.io/,SpringBoot的官方网站进行创建SpringBoot项目;2、通过工具(例如:Idea)创建SpringBoot项目。本次使用开发工具:Idea创建我的第一个SpringBoot项目。 首先,打开我们的Idea开发工具 选择Create New Poject(创建一个新的项目) ...

JACKAL 21万+

SpringBoot学习笔记(第二课时:项目启动)

SpringBoot学习笔记(第二课时) 目录 一、启动准备 二、项目构建 三、项目启动项目方法 一、启动准备 打开前面建立的项目,然后删除没有必要的文件或文件夹 删除.mvn文件夹、HELP.md文件、mvnw文件和mvnw.cmd文件 这个是我删除后的目录 pom.xml:maven的配置文件 src/main/java/com/xxxx/xxxApplication: 项目启动文件,...

Vision_Pinna的博客 314

创建第一个SpringBoot项目

大家好,我是Leo哥🫣🫣🫣,今天给大家带来关于精品SpringBoot专栏,暂且就给他起名为循序渐进学SpringBoot,这里我参考了我上一个专栏:循序渐进学SpringSecurity6。有需要的朋友可以抓紧学习来哈,带你从SpringSecurity从零到实战项目。

分享思想,留下痕迹。 9757

SpringBoot学习笔记(第三课时:项目配置)

SpringBoot学习笔记(第三课时:项目配置) 目录 一、数据库配置 配置一般都写在src/resources/application.propertise文件里面编写 一、基本配置 方法1: 修改默认端口:server.port=8081 修改context-path: server.servlet.context-path=/luckymoney,前面我们http://localhos...

Vision_Pinna的博客 407

双模音频解码器设计:USB+蓝牙LDAC平衡输出方案

音频解码器是数字音频系统中实现数模转换的核心组件,其性能直接决定音质保真度与系统延迟。基于高集成SoC的解码方案通过统一时钟域与片内DSP处理,有效抑制Jitter并简化硬件拓扑;结合全平衡模拟输出架构,可显著提升共模抑制比(CMRR)与信噪比(SNR)。该技术路径广泛应用于便携式Hi-Res音频设备、USB-C小尾巴DAC及蓝牙高解析耳机放大器等场景。本文围绕ES9038Q2M双模SoC展开,详解其在LDAC协议支持、UAC2.0兼容性及平衡电流型DAC输出方面的工程实现,为高性能、可量产音频硬件开发提供

weixin_42613018的博客 390

大连理工大学中文情感词汇本体库(含情绪分析代码)

中文文本数据的情绪计算昨天如何对微博推文进行情绪分析(细粒度情感分析)介绍了英文的NRC情绪词典。虽然支持中文,但由于制作问题,导致并不完全适应中文场景。今天介绍大连理工大学中文情感...

大邓和他的Python 4万+

SpringBoot新手建立项目详解

1、SpringBoot官网:springboot.io 2、准备: JDK: JAVA_HOME:jdk根目录 path:jdk根目录\bin classpath:.;jdk根目录\lib maven: 首先需要下载maven,然后解压缩 MAVEN_HOME:maven根目录 path:maven根目录\bin 配置maven本地仓库:maven根目录\conf\setti...

平行宇宙i的博客 1565

加权余量法求解偏微分方程

加权余量法(Weighted Residual Method)是一种数值方法,用于求解偏微分方程(PDEs)。其基本思想是将偏微分方程的残差(或余量)通过加权函数加权,并使加权余量在定义域上为零,从而形成一组代数方程进行求解。

leizhengshenglzs的博客 1793

【SpringBoot】第一个Springboot项目

目录 前言 一、springboot是什么? 二、Idea创建第一个springboot项目 1.创建一个springboot项目 2.选择依赖 4.写一个测试类 5.启动程序 6.测试 三、总结 前言 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开...

weixin_44382688的博客 1576

Nature、science、cell旗下刊物

Nature\science\cell子刊说明

计算机视觉 5607

Robot Framework 7.0 报告解析

本文深入解析 Robot Framework 7.0 新增的 JSON 报告功能,手把手教你如何从 output.xml 转换为结构清晰的 output.json,并通过 Python 脚本提取关键测试指标。文章附完整示例、命令、解析脚本,支持导出为 CSV 和 Markdown,方便接入可视化看板、群通知和 CI 流程。适用于测试自动化、质量平台建设和回归趋势分析场景。

点点寒彬的博客 266

第一章节:springboot项目构建

springboot教程,springboot构建项目,构建构成中遇到的问题汇总

a954364090的专栏 984

【SpringBoot框架篇】1.搭建第一个springboot项目

文章目录简介特点搭建第一个springboot项目创建项目添加web接口配置启动端口启动程序idea中启动编译成jar包后启动 简介 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新的应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(快速应用程序开发)成为领导者。 特点 .创建独立的Spring应用程序 .嵌入的Tomcat,无需部署WAR文件 .简

皓亮君的博客 3631

【XSRP软件无线电】基于软件无线电平台的QPSK频带通信系统设计(含有完整工程资料获取链接)

软件无线电(Software Defined Radio, SDR)是一种无线通信系统,它通过软件来定义和实现无线电的功能,而不是依赖于传统的硬件电路。SDR平台的核心思想是将传统无线电系统中的大部分硬件功能,如调制解调、信号处理、频率选择等,通过软件来实现。这种设计理念使得SDR具有高度的灵活性和可重配置性,能够适应不同的通信标准和频段,快速适应新的通信技术。

嵌入式技术开发 3285

在SAP系统中,公司间关联交易(Intercompany Transactions)或内部往来主要有三种经典的实现模式。这些模式的选择取决于企业的业务复杂度、自动化需求以及对实时性的要求

SAP系统中公司间关联交易的三种实现模式分析:1)手工记账模式(FB60/FB70)适用于低频交易,灵活性高但易出错;2)SD/MM跨公司销售采购模式(VA01/VF01/ME21N)适用于真实业务流转,业务财务集成度高;3)自动清算模式(F.13/ICR)适合高频交易集团企业,支持实时自动对账。关键成功要素包括正确配置贸易伙伴字段、统驭科目及专用凭证类型。建议根据企业规模、业务复杂度及自动化需求选择合适模式,其中大型集团优先考虑自动对账方案以确保合并报表准确性。

金牌架构师 561

SpringBoot学习笔记——第一节Spring项目的搭建

博客介绍:本文为JAVA SpringBoot学习笔记,和我一起从零开始学习Spring吧本文适合具有一定Java基础并深刻理解OOP思想的同学阅读由于涉及技术细节比较多,所以该博客不会设计特别深入,但对于入门的同学来说会显得通俗易懂Spring技术是为了替代JAVA EE繁琐的开发而推出的,只需要少量配置,就能实现庞大的项目。 Spring项目的搭建:由于笔者平时还是最熟悉在eclipse下进行...

LitaVadaski的博客 662

深度学习工具包 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")

【JavaEE】_第一个SpringBoot项目

1. 在前文创建并运行的第一个SpringBoot项目中,我们没有手动配置Tomcat以及打包、部署等一系列操作,但在启动日志中含有Tomcat的相关记录;idea会帮我们查找相关的代码(在其他文件中使用过)并进行提醒(是否要一起修改),如果确认修改,idea会帮我们把相关联的文件名的相关代码全部进行修改。2. 在servlet项目中,访问webapp的URL有两级路径:127.0.0.1:8080/context path/servlet path。2. 快捷键修改文件名(请勿在Explorer中修改)

m0_63299495的博客 1432

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

使用idea创建第一个springboot项目

前言: 如今springboot越来越火,越来越多的公司选择使用springboot作为项目的开发框架,其设计目的就是用来简化spring项目的搭建和开发过程,省略了传统spring、springmvc项目繁琐的配置,可以让开发人员快速上手。 下面详细说明下如何使用idea创建我们的第一个springboot项目: 首先打开idea主界面选择 Create New Project 在弹...

FarStars的博客 8万+

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

毕业设计-springboot培训机构课时管理系统(案例分析)-附源码

本系统主要采用了Java技术,将所有业务模块采用以浏览器交互的模式,选择MySQL作为系统的数据库,开发工具选择My eclipse来进行系统的设计。基本实现了培训机构课时管理系统 应有的主要功能模块,本系统有管理员、教师用户、学员用户。管理员:后台首页、个人资料(个人信息、修改密码)、系统用户(管理员、教师用户、学员用户)、模块管理(排课信息、课程信息、课时记录、班级信息)。学员用户;后台首页、个人资料(个人信息、修改密码)模块管理(排课信息、课程信息)。教师用户:后台首页、个人资料(个人信息、修改密码)

VX_BSDZ1988的博客 1745

(79)Part20-课时管理-01-课时管理接口

一、新增课时 web层:VideoController.java package com.atguigu.guli.service.edu.controller.admin; @CrossOrigin @Api(tags = "课时管理") @RestController @RequestMapping("/admin/edu/video") @Slf4j public class VideoController { @Autowired private VideoService vid

希冀 339
上一篇: vue项目相关配置
下一篇: SpringBoot学习笔记(第二课时:项目启动)
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值