day80

本文通过创建一个名为`Flying`的接口,展示了如何在软件设计中实现抽象。`Controller`类作为管理者,可以控制任何实现了`Flying`接口的对象,如`Bird`或`Plane`。这体现了非线性和非凸性的概念,虽然不同于神经网络的复杂性,但同样展现了抽象和泛化的思想。
摘要由CSDN通过智能技术生成

神经网络是一种运算模型,由大量的节点(或称神经元)之间相互联接构成。每个节点代表一种特定的输出函数,称为激活函数(activation function)。每两个节点间的连接都代表一个对于通过该连接信号的加权值,称之为权重。


特性:
1.非线性:由于权重是加权于每两个节点间的连接,因此在数学上是非线性。
2.非凸性:并非收敛于特定极限。

3.人类不友好: 由于神经网络通过神经元的权重和激活来表达其行为,因此很难确定其决策背后的逻辑。

4.概括性不佳:经网络将在经过培训的任务上准确执行,但在其他任何方面都表现不佳,即使它与原始问题相似。

package machinelearning.gui;

/**
 * ******************************************
 *
 * @author Michelle Min MitchelleMin@163.com
 * @date 2021-08-13
 * ******************************************
 */
// Day 1. Define an interface.
    interface Flying{
        void fly();
}//of interface Flying

// Day 2. Define a controller to cope with it.
class Controller{
        Flying flying;

        Controller(){
            flying = null;
        }//of Controller

    void setListener(Flying paraFlying){
            flying = paraFlying;
    }//of addListener

    void doIt(){
            flying.fly();
    }//of doIt
}//of Controller

//Day 3. Define class Bird for the interface.
class Bird implements Flying{
        double weight = 0.5;

        public void fly(){
            System.out.println("Bird fly, my weight is " + weight + " kg.");
        }//of fly
}//of class Bird

//Day 4. Define class Plane for the interface.
class Plane implements Flying{
        double price = 100000000;
        public void fly(){
            System.out.println("Plan fly, my price is " + price + " RMB.");
        }//of fly
}//of class Plane.

// Day 5. Test the interface.
public class InterfaceTest {
    public static void main(String[] args){
        Controller tempController = new Controller();
        Flying tempFlying1 = new Bird();
        tempController.setListener(tempFlying1);
        tempController.doIt();

        Flying tempFlying2 = new Plane();
        tempController.setListener(tempFlying2);
        tempController.doIt();
    }//of main
}//of class InterfaceTest

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值