
English: 
Hello again! Welcome back to New Zealand for
a few minutes with More Data Mining with Weka.
Let's look at the Command Line interface in
this lesson.
Now, the Command Line interface isn't for
everyone, but it's worth knowing about, just
in case you might need to do some more advanced
things.
We're going to run a classifier from within
the Command Line interface.
I'm going to run J48 on the iris data.
The first thing I'm going to do is to print
the J48 options.
Let's fire up the Simple Command Line interface.
I'm going to type "java".
Everything's going to begin with "java" in
this.
This is the one line we type into here.

Chinese: 
大家好！欢迎回到新西兰和More Data Mining with Weka。
这节课我们学习命令行界面 （Command Line Interface）。
Command Line Interface 不是一个大众化的界面，但是值得了解，
以便将来你学更高价的内容。
我们将在Command Line Interface运行分类器。
用J48处理iris数据集。
首先，来显示J48的选项。
打开Command Line Interface。
输入“java”。
这里，所有命令行都以"java"开始。
这是我们输入的一行指令。

Chinese: 
输入"java weka.classifiers.trees.J48"（一会儿我再解释这个名字）。
点击“Enter”，很多输出信息显示在页面上。
实际上，这是错误信息。
"WEKA 错误：没有训练文件并且输入文件为空。"
Weka不能理解这行语句，并显示了J48的选项。
首先，通用选项："-h"代表帮助; "-t"代表指定训练文件; "-T"代表指定测试文件。
我们将尝试这些选项。
然后，除了通用选项，我们将学习使用
J48特有的选项。
这是"-C"选项和"-M"选项，还有其他几个J48特有的选项。
为了搞清这些选项的功能，打开Explorer，

English: 
I'm going to type "java weka.classifiers.trees.J48"
(I'll explain the name in a moment).
I'm going to hit Enter, and here I've got
printed out a bunch of information.
Actually, this is error information.
It says "Weka exception: No training file
and no object input file given." So, because
it can't interpret this command, Weka has
kindly printed out the options for J48.
First of all, the general options: "-h" for
help; "-t" for training file; "-T" for test file.
We'll be using those.
Then, a bit further down after the general
options, we've got the options specific to
J48.
There's the "-C" option and the "-M" option,
and a few more options for J48.
To make sense of these options, I've opened
the Explorer here, and this is J48 in the

Chinese: 
这是J48的默认设置。
你可以看到"-C"选项和"-M"选项。
这些是我们要键入Command Line Interface的内容。
这是默认设置，这是J48的参数。
实际上，可以把它们复制过来。
来复制设置。
右键单击，我们把设置复制到剪贴板。
然后回去，找到Command Line Interface开始粘贴。
用Crtl-v粘贴。
哦，应该在行首加上"java"。
我们用Explorer复制来的配置运行这个java程序。
之后，我们需要一个训练文件。
使用"-t"后面加空格，再加上我们的训练文件。

English: 
default configuration.
You can see here the "-C" option and the "-M"
option.
These are things that we type into the Simple
Command Line interface.
This is the default configuration, and these
are parameters for J48.
I can actually copy here:
I'm going to copy the configuration.
I did a right-click, and I'm going to Copy
the configuration to the clipboard.
Then I'm going to go back and find my Simple
Command Line interface, and I'm going to paste.
It's Crtl-v for paste.
Oh, I should have put "java" at the beginning.
I'm going to run this Java program with these
options copied and pasted from the Explorer.
Then I need a training file,
that's "-t" followed by a space, and now I
need to put a file for my training file.

Chinese: 
它在这里。
这是一个带磁盘名称的完整有效的文件名。
不幸的是，在 Command Line Interface，你需要提供
带磁盘名称的完整有效的文件名，这是数据集所在的位置，这是iris.arff。
文件名要用引号括起来，因为在这个文件名中间有空格，
而Windows不喜欢在文件名中包含空格，除非你使用引号。
现在，我们打算再次输入，并用J48处理该数据集。
好了，这是结果。
我们之前多次见过这种输出。
这就是如何在 Command Line Interface运行分类器。
这里，在幻灯片上，这就是我们所做的。
我们从Explorer中复制的分类名称和选项，
然后，我们手动设置训练集。
这是使用 Command Line Interface一个很好的方式。

English: 
Here it is.
It's a fully qualified file name starting
with the disk.
Unfortunately, in the Simple Command Line
interface, you need to have fully qualified
file names, and this is where my datasets
are, and it's the iris.arff file.
I've surrounded it in quotes, because there are
actually spaces in this file name, and Windows
doesn't like file names with spaces, unless
you put quotes around it.
Now I'm just going to hit Enter again, and
it should execute J48 on that dataset.
There we go; this is the result.
We've seen that kind of thing many times before.
So that's how you run classifiers in the Simple
Command Line interface.
Over here on the slide, this is what we did.
We copied the classifier name and the options
from the Explorer, then we put the training
set in afterwards, manually.
That's a good way of using the Command Line
interface.

English: 
I want to talk about this complicated name
"weka.classifiers.trees.J48".
J48 is a class, which roughly means a program
in Java.
It's a collection of variables, along with
some methods -- that is, code -- that operate
on the variables.
Classes come in packages.
A package is a directory containing related
classes.
J48 is in the "trees" package, and the "trees"
package is part of the "classifiers" package.
We can see all this stuff in Javadoc.
It's useful to be able to look at the definitive
documentation for Weka, and we can find that
in our Weka installation.
If I go to where I installed Weka.
Here's "My Computer".
I'm going to go to C, and I installed it in
Program Files (x86).
I'm going to find Weka here.

Chinese: 
来谈谈这个复杂的名字“weka.classifiers.trees.J48”。
J48是一个Java类，大概相当于是Java中的一个程序。
它是变量，加方法的集合，方法就是代码 
- 即在这些变量上进行操作的代码。
Java类可组成包。
包是包含了相关Java类的目录。
J48是在trees包中，trees包是classifiers包的子包。
我们可在Javadoc中查看这些结构。
查看Weka的文档是十分有用的，
我们可以在Weka安装包中找到它。
如果我们到Weka的安装路径。
这里的“我的电脑”。
选择C盘，我在“ProgramFiles （x86）” 下安装了它。
找到Weka。

English: 
There's Weka, and I'm going to find documentation.html.
There is the documentation, and I want to
look at the Package Documentation.
I can see the Weka Manual here, but I'm going
to look at the Package Documentation.
This is called the Javadoc, which is documentation
generated from the Java program.
This is the definitive source of documentation
for Weka.
I'm going to find the classifiers.
These are the packages up here.
It's a little bit complicated.
I'm going to find the "classifiers.trees" package
and click that.
Down here I've got the contents of the "classifiers.trees"
package, and I can click J48.
Here I can see information about the J48 class.
Actually, I could have gotten to the same
thing if I had clicked All classes here and
looked through this alphabetical list down
here for J48, which is here.

Chinese: 
这是Weka，我们要寻找documentation.html。
这就是说明文档，我们想看看包说明文档（Package Documentation）。
我们能看到Weka用户手册在这里，但我们要找Package Documentation。
这就是Javadoc，是由Java程序生成的说明文档。
这是最可靠的Weka说明文档。
去寻找分类器。
分类器包都在这里。
这有点复杂。
要找到classifiers.trees包， 并单击。
往下这里，是classifiers.trees包的内容，单击J48。
这里是J48 Java类的信息。
其实，单击这里的All classes 我们可以得到相同的结果，
并在这个按字母顺序排列的列表中找到J48，在这里，

Chinese: 
可以得到同样的信息。
在Javadoc中，看这里，是一些和计算机相关的的东西，
一些选项。
这是J48选项的最可靠来源。
这些是可在Explorer或Command Line interface使用的选项。
然后这还有很多其他的信息。
回到幻灯片：
我们发现J48在all classes列表中，看看它的文档。
现在，我知道你在想什么：“所有这些令人讨厌的东西是什么？”好了，别担心，
你可以忽略你不理解的东西，只注意这里。
为了解除你的顾虑，本课我们不会大量使用
Command Line interface
事实上，我们将在下一课使用它，但在那之后，将不再使用。
当我们一起看这些的时候，就忍忍吧。

English: 
I get the same information.
When I look at this Javadoc, when I go down
here, you can see some computer-y stuff here,
and you can see the options.
This is the definitive source of the options
for J48.
These are options that you can use in the
Explorer or in the Simple Command Line interface.
Then there's a lot of other information.
Back to the slide here:
we found J48 in the "all classes" list and looked
at it's documentation.
Now, I know what you're thinking: "what's
all this geeky stuff?" Well, don't worry,
just try to ignore things you don't understand,
and just power on through here.
To set your mind at rest, we're not going
to be using the Simple Command Line interface
very much in this course.
In fact, we'll use it in the next lesson,
but after that, we won't be using it at all.
Just bear with us while we look at it.

Chinese: 
我想在Javadoc中找到另外一些东西。
如果你回到Explorer，
或许你从来没有注意到，在这里 
--你可能从来没有注意到，在这里有 Open a database。
Open DB...，单击这个--预处理面板上显示-- 
“从一个数据库打开一个实例集”。
这是一个相当不友好的界面，我得在没有任何帮助下
将它填满。
现在，我们可以在Javadoc中找到相关的说明文档。
我碰巧知道这其实是一个转换器（converter），
一个“数据库转换器”，它是在名为“weka.core.converters”的Weka核心包里。
Weka有一系列核心包，而“转换器（converter）”就是其中之一。

English: 
I want to find another thing in the Javadoc.
If you go back to the Explorer,
perhaps you've never noticed this, but -- I'll
just find the Explorer again, which is here
-- you may never have noticed that here we've
got, this is Open a database.
Open DB..., and if I click this -- this is on
the Preprocess panel -- it says "Open a set
of instances from a database".
I get a rather formidable looking form
I've got to fill in without really any
help.
Now we can find the documentation on this
in Javadoc.
I happen to know this is actually a "converter",
the "database converter", and it's in a package
called "weka.core.converters", the core of Weka.
There's a bunch of packages in the central
core of Weka, and "converters" is one of them.

Chinese: 
我们查看下“数据库转换器（database converter）”和“数据库加载器database loader）”，会看到
关于这个转换器的说明。
这里有点复杂，因为从数据库中读取数据是一个有点复杂的。
我们必须指定了一些内容，比如数据库的URL，用户名，
密码和查询语句，等等。
我们可以指定所有这些事情。
好了，我不想现在就用这个转换器，我只是想告诉你，
Javadoc是Weka中的关于Weka的详细说明文档。
回到幻灯片，
数据库加载器可以从任何JDBC数据库加载。
数据库加载器在Explorer的预处理面板里，但说明文档在Javadoc中。
能够通过找到对应的Javadoc来进一步了解
Weka中的工具是很有帮助的。
关于命令行界面 （Command Line interface），我们就谈到这里。
我已简单地展示了它。

English: 
If I look at the "database converter" and look
at the "database loader", that gives us some
documentation on this converter.
It's a little bit complicated here, because
reading from a database is a little bit complicated.
We've got to specify a number of things here,
like the URL of the database, the username,
a password, and a query, and so on.
We can specify all those things.
Well, I don't want to use this converter now,
I just wanted to show you that the Javadoc
is a source of detailed documentation on different
bits of Weka.
Coming back to the slide,
the database loader will load from any JDBC
database.
It's in the Explorer's Preprocess panel, but
the documentation is here in the Javadoc.
It's useful to be able to find your way around
the Javadoc to see more information about
some of the facilities in Weka.
This is what we've talked about here, the
Command Line interface.
I showed you it quickly.

Chinese: 
Explorer可以做的一切，命令行都可以做到。
我们指定一个负号后跟一个字母后跟一个空格，再跟另一个选项，
例如“-C 0.25”或"-t filename"。
在Command Line interface，你只能键入一行指令，
人们通常不这么做，而是打开一个Windows终端窗口，这样做好一些
--你可以用脚本编写Weka的命令序列。
为了做到这一点，你需要正确设置你的环境，
但这不是本课的内容。
我展示了如何从Explorer中复制和粘贴分类的配置。
事实上，课后练习中你要去查看Javadoc
并找出一些信息，然后你要

English: 
It can do everything the Explorer does from
the command line.
We specify a command with minus followed by
a letter followed by a space and then an option
like "-C 0.25" or "-t filename".
You only get one line in the Command Line
interface to type things, and people often
open a terminal window instead, which gives
you some advantages --
you can do scripting, so you can script a
sequence of Weka commands. But in order to
do that you need to be able to set up your
environment properly, and we're not going
to cover that in this course.
I showed you how you can copy and paste a
configured classifier from the Explorer.
In fact, in the activity that you're just
about to do you're going to look around the
Javadoc and find out some information, and
then you're going to configure something in

English: 
the Explorer and copy that configured classifier
into the Command Line interface and run it
from there.
The advantage of the Command Line interface
is that it gives you more control over memory
usage.
It's a lower level way of accessing
the facilities of Weka, and we'll be doing
a little bit of that in the next lesson.
Javadoc, as I've said, is the definitive source
of Weka documentation.
There is some stuff on the Command Line interface
in the course text in Chapter 14.
Off you go and do the activity, and I'll see
you in the next lesson.
Bye for now!

Chinese: 
在Explorer中进行配置，并且把配置好的分类器复制到Command Line interface
运行。
Command Line interface的好处是，它可以让你更好地控制
内存的使用。
这是使用的Weka工具较初级的方式，
下一课，我们会做一些类似的事。
Javadoc，正如我已经说过，是最可靠的的Weka说明文档。
课本的第14章有一些有关于Command Line interface的内容。
好了，去做练习吧，我们下一堂课再见。
再见了！
