think in java interview-高级开发人员面试宝典(五)

VMFS数据存储(datastore)丢失后恢复步骤 vmfs datastore恢复步骤 阅读详情

这次开始我们来点洋文吧。

有些基础,大家可能用中文知道如何表示,但是面试官如果让你用全英语表达你就不知道如何去说了,那么下面我们将给出对于一些常用的JAVA基础知识的英语问答以及相关的答案。

大家可以看一下如何用英语去回答这些基础的问题,找一下感觉。


Overriding & Overloading


Overriding - same method names with same arguments and same return types associated in a class and its subclass. 

Overloading - same method name with different arguments, may or may not be same return type written in the same class itself.


What's the difference between an interface and an abstract class?

  • An abstract class may contain code in method bodies, which is not allowed in an interface. With abstract classes, you have to inherit your class from it and Java does not allow multiple inheritance. On the other hand, you can implement multiple interfaces in your class.
  • What’s the difference between Hashtable and Hashmap
  • They Both provide key-value access to data. 
  • The key difference between the two is that access to the Hashtable is synchronized on the table while access to the HashMap isn't. You can add it, but it isn't there by default.
  • Another difference is that iterator in the HashMap is fail-safe while the enumerator for the Hashtable isn't. 
  • And, a third difference is that HashMap permits null values in it, while Hashtable doesn't. 


What do you understand by Synchronization?


Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption.

Synchronized statement and Synchronized block

Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method'sobject or class. Synchronized statements are similar to synchronized methods, always use synchronized(this) to instead of.


What is difference between jdbc3.0 and jdbc2.0? What’s the new features in jdbc3.0?

这道题可见老外的面试对基础是多么的重视,回答时掌握好6点


The JDBC 3.0 API introduces new material and changes in these areas:

1. Savepoint support
  Added the Savepoint interface, which contains new methods to set, release, or roll back a transaction to designated savepoints.


2. Reuse of prepared statements by connection pools

Added the ability for deployers to control how prepared statements are pooled and reused by connections.


3. Connection pool configuration Defined a number of properties for the ConnectionPoolDataSource interface.

These properties can be used to describe how pooledConnection objects created by DataSource objects should be pooled.

4. Retrieval of parameter metadata

Added the interface ParameterMetaData, which describes the number, type and properties of parameters to prepared statements.

5. Retrieval of auto-generated keys

Added a means of retrieving values from columns containing automatically generated values.

6.  Ability to have multiple open ResultSet objects

Added the new method getMoreResults(int), whichtakes an argument that specifies whether ResultSet objects returned by a Statement object should be closed before returning any subsequent ResultSet objects.

What's the difference between the methods sleep() and wait()

简单了不能再简单的一道题了,可是用英语如何回答呢?来!

The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread

What is oops


OOPs is the new concept of programming parallel to Procedure oriented programming
There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation
It help in programming approach in order to built robust user friendly and efficient softwares and provide the efficient way to maintain real world softwares..


What is Authentication & Authorization

这道题很猛,来自于Oracle的一次面试。

Fundamentally, authentication is performed by a series of Spring Security filter (implementations of J2EE Servlet Filters) chains, linked together. Each element in a given chain has a dedicated responsibility, while each chain is responsible for accomplishing high-level goals towards the handling of a request. Ultimately, these chains must prepare a request to fulfill a single contract enforced by the last link in the primary security filter chain.


Authentication 

An authentication system is how you identify yourself to the computer. The goal behind an authentication system is to verify that the user is actually who they say they are. 
There are many ways of authenticating a user. Any combination of the following are good examples. 

Password based authentication 

Requires the user to know some predetermined quantity (their password). 
  • Advantages: Easy to impliemnt, requires no special equipemnt. 
  • Disadvantages: Easy to forget password. User can tell another user their password. Password can be written down. Password can be reused. 

Device based authentication 

Requires the user to posses some item such as a key, mag strip, card, s/key device, etc. 
  • Advantages: Difficult to copy. Cannot forget password. If used with a PIN is near useless if stolen. 
  • Disadvantages: Must have device to use service so the user might forget it at home. Easy target for theft. Still doesn't actually actively identify the user. 

Biometric Authentication 

  • My voice is my passport. Verify me. This is from the movie sneakers and demonstrates one type of biometric authentication device. It identifies some physical charactistic of the user that cannot be seperated from their body. 

Retina Scanners

  • Advantages: Accurately identifies the user when it works. 
  • Disadvantages: New technology that is still evolving. Not perfect yet. 

Hand Scanners 

  • Advantages: Difficult to seperate from the user. Accurately identifies the user. 
  • Disadvantages: Getting your hand stolen to break into a vault sucks a lot more than getting your ID card stolen. 

Authorization 

Once the system knows who the user is through authentication, authorization is how the system decides what the user can do. 
A good example of this is using group permissions or the difference between a normal user and the superuser on a unix system. 
There are other more compicated ACL (Access Control Lists) available to decide what a user can do and how they can do it. Most unix systems don't impliment this very well (if at all.) 


What is generic type?

中文回答一下,谁都可以答得出,够简单吧,试着用英语回答呢?

When you take an element out of a Collection, you must cast it to the type of element that is stored in the collection. Besides being inconvenient, this is unsafe. The compiler does not check that your cast is the same as the collection's type, so the cast can fail at run time. 
Generics provides a way for you to communicate the type of a collection to the compiler, so that it can be checked. Once the compiler knows the element type of the collection, the compiler can check that you have used the collection consistently and can insert the correct casts on values being taken out of the collection. 


What is autoboxing and unboxing?

很多人中文可能都不一定回答得出这道题,自动装箱,折箱,忘了吧?

Autoboxing, introduced in Java 5, is the automatic conversion the Java compiler makes between the primitive (basic) types and their corresponding object wrapper classes (eg, int and Integer, double and Double, etc). The underlying code that is generated is the same, but autoboxing provides a sugar coating that avoids the tedious and hard-to-read casting typically required by Java Collections, which can not be used with primitive types.


What is equals() and hashcode()

又来了,具体原理和算法看:hashcode & equals之5重天


Java.lang.Object has methods called hasCode() and equals(). These methods play a significant role in the real time application. However its use is not always common to all applications. In some case these methods are overridden to perform certain purpose. In this article I will explain you some concept of these methods and why it becomes necessary to override these methods.

hashCode()
As you know this method provides the has code of an object. Basically the default implementation of hashCode() provided by Object is derived by mapping the memory address to an integer value. If look into the source of Object class , you will find the following code for the hashCode.
public native int hashCode();
It indicates that hashCode is the native implementation which provides the memory address to a certain extent. However it is possible to override the hashCode method in your implementation class. 

equals()
This particular method is used to make equal comparison between two objects. There are two types of comparisons in Java. One is using “= =” operator and another is “equals()”. I hope that you know the difference between this two. More specifically the “.equals()” refers to equivalence relations. So in broad sense you say that two objects are equivalent they satisfy the “equals()” condition. If you look into the source code of Object class you will find the following code for the equals() method


 

下面开始来几道J2EE的面试题


 

What is the Lazy Loading

Lazy loading in Hibernate means fetching and loading the data,    
only when it is needed, from a persistent storage like a database.     
Lazy loading improves the performance of data fetching and significantly reduces the memory footprint.
In Hibernate, there are two main components which can be lazy loaded. 
They are namely Entities and Collections. 
An Entity represents a relational data in database, whereas a collection represents collection of children for an entity.


What is MVC

Model–view–controller (MVC) is an architecturalpattern used in softwareengineering. Successful use of the pattern isolates business logic from user interface considerations, resulting inan application where it is easier to modify either the visual appearance of theapplication or the underlying business rules without affecting the other

Model

Business logic goes here

View

Presentation logic goes here

Controller

Application logic goes here


What is Spring

Springfeature:

The Spring Framework comprisesseveral modules that provide a range of services:


Why use hibernate

1. Hibernate generates very efficient queries very consistently

Hibernateemploys very agressive, and very intelligent first and second level cachingstrategy.

Thisis a major factor in acheiving the high scalability.

2. Cross-Database You only have to change the databasedialect.


 

What is dependency-injection

Software components (Clients), are often a part of a set of collaborating components which depend upon other components (Services) to successfully complete their intended purpose. In many scenarios, they need to know “which” components to communicate with, “where” to locate them, and “how” to communicate with them. When the way such services can be accessed is changed, such changes can potentially require the source of lot of clients to be changed.

One way of structuring the code is to let the clients embed the logic of locating and/or instantiating the services as a part of their usual logic. Another way to structure the code is to have the clients declare their dependency on services, and have some "external" piece of code assume the responsibility of locating and/or instantiating the services and simply supplying the relevant service references to the clients when needed.


What's difference between criterial query and hql:



Criteria is an object-oriented API, while HQL means string concatenation. That means all of the benefits of object-orientedness apply:
1. All else being equal, the OO version is somewhat less prone to error. Any old string could get appended into the HQL query, whereas only valid Criteria objects can make it into a Criteria tree. Effectively, the Criteria classes are more constrained.
2. With auto-complete, the OO is more discoverable (and thus easier to use, for me at least). You don't necessarily need to remember which parts of the query go where; the IDE can help you
3. You also don't need to remember the particulars of the syntax (like which symbols go where). All you need to know is how to call methods and create objects.
Since HQL is very much like SQL (which most devs know very well already) then these "don't have to remember" arguments don't carry as much weight. If HQL was more different, then this would be more importatnt.


Pls tell me the advantage points or new features of Spring FrameWork?

The Spring Framework comprises several modules that provide a range of services:


Inversion of Control container: configuration of application components and lifecycle management of Java objects


Aspect-oriented programming: enables implementation of cross-cutting routines
Data access: working with relational database management systems on the Java platform using JDBC and object-relational mapping tools

Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
Model-view-controller: an HTTP and Servlet-based framework providing hooks for extension and customization

Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting RMI, CORBA and HTTP-based protocols including web services (SOAP)

Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management

Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly Acegi).
Remote Management: configurative exposure and management of Java objects for local or remote configuration via JMX

Messaging: configurative registration of message listener objects for transparent message consumption from message queues via JMS, improvement of message sending over standard JMS APIs

Testing: support classes for writing unit tests and integratio

What is spring transaction managerment?

Spring provides a consistent abstraction for transaction management. This abstraction is one of the most important of Spring's abstractions, and delivers the following benefits:
Provides a consistent programming model across different transaction APIs such as JTA, JDBC, Hibernate, iBATIS Database Layer and JDO.
Provides a simpler, easier to use, API for programmatic transaction management than most of these transaction APIs
Integrates with the Spring data access abstraction
Supports Spring declarative transaction management

the difference between BeanFactory and ApplicationContext ?

Two of the most fundamental and important packages in Spring are the org.springframework.beans and org.springframework.context packages. Code in these packages provides the basis for Spring's Inversion of Control (alternately called Dependency Injection) features. The BeanFactory provides an advanced configuration mechanism capable of managing beans (objects) of any nature, using potentially any kind of storage facility. The ApplicationContext builds on top of the BeanFactory (it's a subclass) and adds other functionality such as easier integration with Springs AOP features, message resource handling (for use in internationalization), event propagation, declarative mechanisms to create the ApplicationContext and optional parent contexts, and application-layer specific contexts such as the WebApplicationContext, among other enhancements.


Tell me what is AOP?

1. Aspect: A modularization of a concern that cuts across multiple objects. Transaction management is a good example of a crosscutting concern in J2EE applications.

2. Join point

3.  Advice

4.  Pointcut

5.  Introduction

6.  Target object

7.  Weaving

How many Types of advice are there in Spring Framework:

  •  Before advice
  •  After returning advice
  •  After throwing advice
  •  After (finally) advice
  • Around advice

每篇不宜写过多,先写这么多吧,下次继续,嘿嘿!!!

 

转载地址:http://blog.youkuaiyun.com/lifetragedy/article/details/9878839

【机械视觉】Halcon—【二、Halcon算子全面介绍(超详细版)】 Halcon 的算子(operators)按照功能被系统性地划分为多个类别,官方文档中目前(Halcon 22.11 版本)共有 19 个主分类,每个主分类下还有若干子分类。 本人在此对这19个分类的常用核心算子进行了一系列的总结,且本人在文章最后还总结了一些案例经验。 注意: ​​​​​​​跨分类调用:某些算子可能在多个分类中,但官方文档中会明确其主分类。 例如: read_image(文件操作)常被其他分类(如图像处理)的示例调用,但其核心功能是文件读取。 阅读详情

相关推荐

NXP应用随记(八):S32K3XX的HSE学习记录(HSE\MU\UTEST\IVT\A,B SWAP)

HSE,即硬件安全引擎(Hardware Security Engine),是NXP S32K312微控制器(MCU)中的一个功能,它提供了一系列的安全特性,包括加密、安全启动和密钥存储等。这些功能旨在增强汽车电子系统的信息安全,符合ISO26262标准,达到ASIL D安全等级。具体来说,S32K312的HSE支持AES-128/192/256加密、RSA、ECC等加密算法,以及侧通道保护,确保了数据传输和存储的安全性。

梦想技术家 9740

2021-04-28

重写equals方法 Java中的equals()方法是在Object类中定义,Object类是所有类的父类。换句话说,任何类都隐含地继承了该方法。判断两个对象的内容是否相同,必须使用equals()方法,对于没有重写该方法的类,需要重写该方法。重写equals()方法代码如下:Java中的equals()方法是在Object类中定义,Object类是所有类的父类。换句话说,任何类都隐含地继承了该方法。判断两个对象的内容是否相同,必须使用equals()方法,对于没有重写该方法的类,需要重写该方法。重写.

qq_43001775的博客 343

树莓派4B:控制步进电机

文章目录准备阶段接线阶段树莓派程序 准备阶段 准备以下物品,淘宝都可以买到: 57步进电机 电源开关(220v转24v,3A,72W) 步进电机驱动器 电源线 电线 杜邦线 树莓派4B一套 具体型号如下: 接线阶段 整体:接线效果如下图 电源开关起220v转24v作用,很好接线,输出24v接入步进电机驱动器 步进电机驱动器的 A+ A- B+ B- 按提示接步进电机四线,步进电机上就会有说...

学习路上的鸭子的博客 1万+

java 对象是否相等_Java中判断对象是否相等的equals()方法使用教程

Object类中的equals方法用于检测一个对象是否等于另一个对象。在Object类中,这个方法判断两个对象是否具有相同的引用,如果两个对象具有相同的引用,它们一定是相等的。从这点上看,将其作为默认操作也是合乎情理的。然而,对于多数类类说,这种判断并没有什么意义,例如,采用这种方式比较两个PrintStream是否相等就完全没有意义。然而,经常需要检测两个对象状态的相等性,如果两个对象的状态相等...

weixin_31342203的博客 1269

(二)目标检测之 HOG+SVM 算法

文章目录一、概述二、方法概述三、积分图四、AdaBoost五、级联检测六、结果七、复现八、总结参考资料 一、概述   梯度直方图HOG(Histogram of Oriented Gradients)是法国人Dalal在2005年CVPR会议上提出的特征提取算法,并将其与 SVM 配合,用于行人检测。论文地址:Histograms of oriented gradients for human detection HOG有个优点,提取的边缘和梯度特征能很好的抓住局部形状的特点,且因是对图像做了Gamma

天青如水的博客 1万+

2026 年 AI 大模型资讯深度研究报告 / 2026 年 3 月 11 日

2026 年已成为 AI 大模型发展的关键拐点年。从 2023 年 ChatGPT 开启的技术奇点,历经多模态突破、推理能力崛起,至 2025 年形成产业爆发态势,AI 大模型正从"技术验证期"迈向"产业落地期"。核心发现技术突破: OpenAI 于 2026 年 3 月 6 日发布 GPT-5.4,首次实现原生计算机操控能力,在 OSWorld 桌面操控测试中以 75% 成功率超越人类 (72.4%),标志着 AI 从"对话工具"向"自主数字员工"的时代跃迁市场格局。

AI天才研究院 780

java提高篇(十二)-----equals()

equals() 超类Object中有这个equals()方法,该方法主要用于比较两个对象是否相等。该方法的源码如下: public boolean equals(Object obj) { return (this == obj); } 我们知道所有的对象都拥有标识(内存地址)和状态(数据),同时“==”比较两个对象的的内存地址,所以说使用Object的eq...

chenssy 的技术博客 455

可编程逻辑控制器(PLC)系列:Mitsubishi MELSEC-Q_(8).MELSEC-Q系列PLC故障诊断与维护

MELSEC-Q系列PLC的故障诊断与维护是一个系统性的过程,需要工程师具备扎实的理论基础和丰富的实践经验。通过了解故障类型、使用诊断工具、遵循诊断步骤,可以有效地定位和解决故障问题。同时,定期的检查与保养、备份与恢复、优化程序和配置,以及提供良好的运行环境,可以减少故障的发生,提高系统的可靠性。希望本文能够帮助工程师在故障诊断与维护过程中更加得心应手,确保MELSEC-Q系列PLC的稳定运行。

2401_87715305的博客 1247

java equals重写原则_如何正确的重写equals方法(避免各种陷阱)

How to Write an Equality Method in Java文章以几个陷阱的方式逐步来研究如何正确的重写equals方法,虽然是英文的,不过总的来说还是通俗易懂,而且分析的挺透彻,相信大家都能看懂,以下是英文全文:Commmon equality pitfallsClassjava.lang.Objectdefines anequalsmethod, which subc...

weixin_35648203的博客 1647

[ 人力资源面试篇 ] HR 面试题分析详解大集合,看完直怼面试官(二)

那么在这个系列的文章中,我们聊到 HR 面谈什么?并且总结了五十个常见的人力资源面试题,在这里分享给大家。

qq_51577576的博客 1380

大模型——Coze工作流实战:一键生成像素风格视频

本文介绍了如何利用Coze平台工作流生成像素风格心理学短视频的方法。通过创建工作流、设置变量节点、调用大模型生成文案、数据格式化处理、合成音频、生成字幕等步骤,最终实现从输入主题到生成完整视频的自动化流程。文章详细展示了每个节点的具体配置方法,包括提示词编写和数据处理脚本,为读者提供了完整的像素风格视频制作解决方案。

816

think in java interview-高级开发人员面试宝典(一)

无论你是在职,非在职,高级工程师,工程师,架构师,如果你正在面试阶段,请看完此文,相信这篇文章对你的职业生涯和阶值观会发生重大的改变。如果你是一名PM或者是管理者正在物色合适的开发人选,那么我相信这篇文章会在在如何挑选技术型人材上给你带来重大的帮助。作为一名技术型人材由期是程序员,用什么可以恒量自己是否合格或者我们怎么去恒量一个程序员是否质深,比如说:他可以适合一般的软件工程师岗位,还是适合高级工

打造全国最全的AI Agent开发知识领域的博客 2万+

深入URP之Shader篇1: URP Shader概述

我们知道,URP和HDRP都是基于SRP的,尽管现在可以使用Shader Graph编写Shader,但是手写Shader仍然是有一定的优势,特别是在性能方面,手写Shader可以更极致的优化,因此我们在项目中前期都是直接使用Shader Graph编写Shader,项目后期会改成手写Shader来提高性能。而在SRP中手写Shader,我们仍然使用的是Shader Lab,这个结构并没有太大的变化,但是SRP Shader中使用Shader Lab语言还是有几点不同。

聚焦游戏和图形引擎开发技术 4635

think in java interview-高级开发人员面试宝典(二)

从现在开始,以样题的方式一一例出各种面试题以及点评,考虑到我在前文中说的,对于一些大型的外资型公司,你将会面临全程英语面试,因此我在文章中也会出现许多全英语样题。这些题目来自于各个真实的公司,公司名我就不一一例举了,是本人一直以为苦心收藏的。一个JAVA 的MAIN方法引发的一场血案Q:    What if the main method is declared as private?A:

打造全国最全的AI Agent开发知识领域的博客 4万+

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

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

think in java interview-高级开发人员面试宝典(九)

模拟面试今天来谈一下面试时的综合能力。下面先来看一份简历的摘要。熟练掌握SPRING, STRUTS1, 2, HIBERNATE;J2EE方面5年工作经验;ORACLE使用经验48个月;熟练掌握JAVA缓存机制;了解工作流、ERP、EAI工作机制并有实际项目经验;老实说,一般面试官看到上面的简历就会想让这个人来面试了,因为真的你SSH,ORACLE,ERP或者是EAI等工作过5年很利害了已经,于

打造全国最全的AI Agent开发知识领域的博客 1万+

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

think in java interview-高级开发人员面试宝典(四)

算出num个数内的质数 质数即大于1的一个自然数,这个数可以被1和自身整除,如算出20之内的质数,它们有2,3,5,7,11,13,17,19这样的数字。这道题也是面试过程中笔试常问的一道题。 这道题的其目的在于: 1. 看笔试者的数学还记不记得 2. 看笔试者平时的算法 因此答题有两种。 第一种,通用做法 [java] view pl

islittletan的专栏 856

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

think in java interview-高级开发人员面试宝典(八)

Java IO流的复习。大家平时J2EE写多了,JAVA的IO操作可能都已经生疏了,面试时如果来上这么几道,是不是有点”其实这个问题很简单,可是我就是想不起来“的感觉啊?呵呵!JAVA的IO操作太多,我这边挑腾迅,盛大和百度的几道面试题,并整理出答案来供大家参考。InputFromConsole这个最简单不过了,如果你不复习的话,嘿嘿,还真答不出,来看:package org.sky.io; p

打造全国最全的AI Agent开发知识领域的博客 1万+

think in java interview-高级开发人员面试宝典(六)

写了这么多JAVA基础,来点SQL吧!一般面试时考SQL,主要就是考你“统计分析”这一块,下面我们来看面试官经常采用的手段。由4张简单的不能再简单的表,演变出50道SQL哈哈哈哈,够这个面试官面个15,20个人,不带重复的了,而且每个SQL你真的不动动脑子还写不出呢,你别不服气,下面开始。表结构:表Student(S#,Sname,Sage,Ssex) 学生表 S#student_noSagest

打造全国最全的AI Agent开发知识领域的博客 1万+
上一篇: think in java interview-高级开发人员面试宝典(四)
下一篇: think in java interview-高级开发人员面试宝典(六)
7star_java
博客等级 码龄15年 80粉丝 127原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值