小编Sha*_*amy的帖子

在八度音阶和蟒蛇之间混淆

最近我完成了 Andrews Ng 在 coursera 上的 ML 课程。这是一个很棒的课程。在整个课程中,我一直在使用八度音程。但是,与八度音程相比,python 更受欢迎。所以,我现在已经开始学习python了。我正在使用 python 实现线性回归。我什么都不做。只需调用线性回归的预定义函数。但是,在八度音阶中,我曾经从头开始编写代码。我必须使用梯度下降算法找到参数。但是,python 中没有这样的东西。我参考了以下链接:https : //towardsdatascience.com/linear-regression-python-implementation-ae0d95348ac4

我的问题是,我们不会使用诸如梯度下降之类的任何算法来学习参数 Theta 吗?一切都是在python中预定义的吗?

谢谢。

python machine-learning octave

2
推荐指数
1
解决办法
1359
查看次数

findViewById()以两个整数简单应用程序的总和返回null

我是android的新手.我已经为两个整数的Sum编写了代码.我收到NULLPointerException.findViewById()方法返回null.有人可以帮我修复错误.

    <EditText
        android:id="@+id/firstInt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:hint="@string/InputHint"
        />


    <EditText
        android:id="@+id/secondInt"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:hint="@string/InputHint"
        />

    <TextView
        android:id="@+id/result"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Result"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:textSize="18dp"
        />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/add"
        android:layout_gravity="center"
        android:onClick="calculateAdd"/>
Run Code Online (Sandbox Code Playgroud)

MainActivity.java:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        EditText e1 = (EditText)findViewById(R.id.firstInt);
        EditText e2 = (EditText)findViewById(R.id.secondInt);
        TextView tv = (TextView)findViewById(R.id.result);
    }

    public void calculateAdd(View view){

            int x = Integer.parseInt(e1.getText().toString());
            int y = Integer.parseInt(e2.getText().toString());

            int z = x + y;

        tv.setText(z);
    }
Run Code Online (Sandbox Code Playgroud)

这是我编写的一个非常简单的程序.但是,面对这个问题.

我的堆栈跟踪错误:

java.lang.IllegalStateException: Could …
Run Code Online (Sandbox Code Playgroud)

android android-layout

0
推荐指数
1
解决办法
66
查看次数