第一篇:LibSvm 使用說明 學習心得
LibSvm 使用說明 學習心得
(本頁內容來自互聯網,如果對您的利益造成侵害,請通知我,我會立即刪除!)
View this tutorial in: English Only TraditionalChinese Only Both(Default)(req.JavaScript if you want to switch languages)Core StyleSheets: Chocolate Midnight Modernist Oldstyle Steely Swiss Traditional Ultramarine
* This document is written in multilingual format.We strongly suggest that you choose your language first to get a better display.piaip's Using(lib)SVM Tutorial piaip 的(lib)SVM 簡易入門
piaip at csie dot ntu dot edu dot tw, Hung-Te Lin Fri Apr 18 15:04:53 CST 2003 $Id: svm_tutorial.html,v 1.12 2005/10/26 06:12:40 piaip Exp piaip $ 原作:林弘德,轉載請保留原出處
Why this tutorial is here
我一直覺得 SVM 是個很有趣的東西,不過也一直沒辦法(mostly 沖堂)去聽 林智仁老師 的 Data mining 跟 SVM 的課; 后來看了一些網絡上的文件跟聽 kcwu 講了一下 libsvm 的用法后,就想整理一下,算是對于并不需要知道完整 SVM 理論的人提供使用 libsvm 的入門。原始 libsvm 的 README 跟 FAQ 也是很好的文件,不過你可能要先對 svm 跟流程有點了解才看得懂(我在看時有這樣的感覺); 這篇入門就是為了從零開始的人而寫的。I've been considering SVM as an interesting and useful tool but couldn't attend the “Data mining and SVM” course by prof.cjline about it(mostly due to scheduling conflicts).After reading some materials on the internet and discussing libsvm with some of my classmates and friends , I wanted to provide some notes here as a tutorial for those who do not need to know the complete theory behind SVM theory to use libsvm.The original README and FAQ files that comes with libsvm are good documents too.But you may need to have some basic knowledge of SVM and its workflow(that's how I felt when I was reading them).This tutorial is specificly for those starting from zero.后來還有一些人提供意見,所以在此要感謝: I must thank these guys who provided feedback and helped me make this tutorial: kcwu, biboshen, puffer, somi 不過請記得底下可能有些說法不一定對,但是對于只是想用 SVM 的人來說我覺得這樣說明會比較易懂。Remember that some aspect below may not be correct.But for those who just wish to “USE” SVM, I think the explanation below is easier to understand.這篇入門原則上是給會寫基本程序的人看的,也是給我自己一個備忘 , 不用太多數學底子,也不用對 SVM 有任何先備知識。This tutorial is basically for people who already know how to program.It's also a memo to myself.Neither too much mathmatics nor prior SVM knowledge is required.還看不懂的話有三個情形 , 一是我講的不夠清楚 , 二是你的常識不足 , 三是你是小白 ^^;If you still can't understand this tutorial, there are three possibilities: 1.I didn't explain clearly enough, 2.You lack sufficient common knowledge, 3.You don't use your brain properly ^^;我自己是以完全不懂的角度開始的,這篇入門也有不少一樣不懂 SVM 的人 看過、而且看完多半都有一定程度的理解,所以假設情況一不會發生,那如果不懂一定是后兩個情況 :P 也所以 , 有問題別問我。Since I begin writing this myself with no understanding of the subject, ans this document has been read by many people who also didn't understand SVM but gained a certain level of understanding after reading it, possibility 1 can be ruled out.Thus if you can't understand it you must belong to the latter two categories, :P thus even if you have any questions after reading this, don't ask me.SVM: What is it and what can it do for me?
SVM, Support Vector Machine , 簡而言之它是個起源跟類神經網絡有點像的東西,不過現今最常拿來就是做分類(classification)。也就是說,如果我有一堆已經分好類的東西(可是分類的依據是未知的!),那當收到新的東西時,SVM 可以預測(predict)新的數據要分到哪一堆去。SVM, Support Vector Machine , is something that has similar roots with neural networks.But recently it has been widely used in Classification.That means, if I have some sets of things classified(But you know nothing about HOW I CLASSIFIED THEM, or say you don't know the rules used for classification), when a new data comes, SVM can PREDICT which set it should belong to.聽起來是很神奇的事(如果你覺得不神奇,請重想一想這句話代表什么: 分類的依據是未知的!,還是不神奇的話就請你寫個程序 解解看這個問題),也很像要 AI 之類的高等技巧...不過 SVM 基于 統計學習理論 可以在合理的時間內漂亮的解決這個問題。It sounds marvelous and would seem to require advanced techniques like AI searching or some time-consuming complex computation.But SVM used some Statistical Learning Theory to solve this problem in reasonable time.以圖形化的例子來說明(by SVMToy), 像假定我在空間中標了一堆用顏色分類的點 , 點的顏色就是他的類別 , 位置就是他的數據 , 那 SVM 就可以找出區隔這些點的方程式 , 依此就可以分出一區區的區域;拿到新的點(數據)時 , 只要對照該位置在哪一區就可以(predict)找出他應該是哪一顏色(類別)了 : Now we explain with a graphical example(by SVMToy), I marked lots of points with different colors on a plane, the color of each point is its “class” and the location is its data.SVM can then find equations to split these points and with these equations we can get colored regions.When a new point(data)comes, we can find(predict)what color(class)a point should be just by using the point's location(data)原始資料分布 Original Data SVM 找出來的區域 SVM Regions
當然 SVM 不是真的只有畫圖分區那么簡單 , 不過看上面的例子應該可以了解 SVM 大概在作什么.Of course SVM is not really just about painting and marking regions, but with the example above you should should be able to get some idea about what SVM is doing.要對 SVM 再多懂一點點,可以參考 cjlin 在 data mining 課的 slides: pdf or ps。底下我試著在不用看那個 slide 的情況 解釋及使用 libsvm。To get yourself more familiar with SVM, you may refer to the slides cjlin used in his Data Mining course : pdf or ps.I'm going to try to explain and use libSVM without those slides.所以 , 我們可以把 SVM 當個黑盒子 , 數據丟進去讓他處理然后我們再來用就好了.Thus we can consider SVM as a black box.Just push data into SVM and use the output.How do I get SVM?
林智仁(cjlin)老師 的 libsvm 當然是最完美的工具.Chih-Jen Lin 's libsvm is of course the best tool you can ever find.Download libsvm
下載處 : Download Location: libsvm.zip or libsvm.tar.gz
.zip 跟.tar.gz 基本上是一樣的 , 只是看你的 OS;習慣上 Windows 用.zip 比較方便(因為有 WinZIP, 不過我都用 WinRAR), UNIX 則是用.tar.gz Contents in the.zip and.tar.gz are the same.People using Windows usually like to use.zip files because they have WinZIP, which I always replace with WinRAR.UNIX users mostly prefer.tar.gz Build libsvm
解開來后 , 假定是 UNIX 系統 , 直接打 make 就可以了;編不出來的話請 詳讀說明和運用常識.因為這是 tutorial, 所以我不花時間細談 , 而且 會編不出來的情形真是少之又少 , 通常一定是你的系統有問題或你太笨了.其它的子目錄可以不管 , 只要 svm-train, svm-scale, svm-predict 三個執行檔有編出來就可以了.After you extracted the archives, just type make if you are using UNIX.You may ignore some of the subdirectories.We only need these executable files: svm-train, svm-scale, and svm-predict
Windows 的用戶要自己重編當然也是可以 , 不過已經有編好的 binary 在里面了 : 請檢查 windows 子目錄 , 應該會有 svmtrain.exe, svmscale.exe, svmpredict.exe, svmtoy.exe.Windows users may rebuild from source if you want, but there're already some prebuilt binaries in the archive: just check your “windows” subdirectory and you should find svmtrain.exe, svmscale.exe, svmpredict.exe, and svmtoy.exe.Using SVM
libsvm 有很多種用法 , 這篇 tutorial 只打算講簡單的部分.libsvm has lots of functions.This tutorial will only explain the easier parts(mostly classification with default model).The programs
解釋一下幾個主要執行檔的作用 :(UNIX/Windows 下檔名稍有不同 , 請用常識理解我在講哪個)I'm going to describe how to use the most important executables here.The filenames are a little bit different under Unix and Windows, apply common sense to see which I'm referring to.svmtrain Train(訓練)data.跑 SVM 被戲稱為 “ 開火車 ” 也是由于這個程序名而來.train 會接受特定格式的輸入 , 產生一個 “Model” 檔.這個 model 你可以想象成 SVM 的內部數據 , 因為 predict 要 model 才能 predict, 不能直接吃原始數據.想想也很合理 , 假定 train 本身是很耗時的動作 , 而 train 好可以以某種形式存起內部數據 , 那下次要 predict 時直接把那些內部數據 load 進來就快多了.Use your data for training.Running SVM is often referred to as 'driving trains' by its non-native English speaking authors because of this program.svmtrain accepts some specifically format which will be explained below and then generate a 'Model' file.You may think of a 'Model' as a storage format for the internal data of SVM.This should appear very reasonable after some thought, since training with data is a time-consuming process, so we 'train' first and store the result enabling the 'predict' operation to go much faster.svmpredict 依照已經 train 好的 model, 再加上給定的輸入(新值), 輸出 predict(預測)新值所對應的類別(class).Output the predicted class of the new input data according to a pre-trained model.svmscale Rescale data.因為原始數據可能范圍過大或過小 , svmscale 可以先將數據重新 scale(縮放)到適當范圍.Rescale data.The original data maybe too huge or small in range, thus we can rescale them to the proper range so that training and predicting will be faster.File Format
檔案格式要先交代一下.你可以參考 libsvm 里面附的 “heart_scale”: This is the input file format of SVM.You may also refer to the file “heart_scale” which is bundled in official libsvm source archive.[label] [index1]:[value1] [index2]:[value2]...[label] [index1]:[value1] [index2]:[value2].....一行一筆資料,如 One record per line, as: +1 1:0.708 2:1 3:1 4:-0.320 5:-0.105 6:-1
label 或說是 class, 就是你要分類的種類,通常是一些整數。Sometimes referred to as 'class', the class(or set)of your classification.Usually we put integers here.index 是有順序的索引,通常是放連續的整數。Ordered indexes.usually continuous integers.value 就是用來 train 的數據,通常是一堆實數。The data for training.Usually lots of real(floating point)numbers.每一行都是如上的結構 , 意思就是 : 我有一排資料 , 分別是 value1, value2,....valueN,(而且它們的順序已由 indexN 分別指定),這排數據的分類結果就是 label。Each line has the structure described above.It means, I have an array(vector)of data(numbers): value1, value2,....valueN(and the order of the values are specified by the respective index), and the class(or the result)of this array is label.或許你會不太懂,為什么會是 value1,value2,....這樣一排呢? 這牽涉到 SVM 的原理。你可以這樣想(我沒說這是正確的),它的名字就叫 Support “Vector” Machine,所以輸入的 training data 是 “Vector”(向量), 也就是一排的 x1, x2, x3,...這些值就是 valueN,而 x[n] 的 n 就是 由 indexN 指定。這些東西又稱為 “attribute”。真實的情況是,大部份時候我們給定的數據可能有很多 “ 特征(feature)” 或說 “ 屬性(attribute)”,所以輸入會是 一組的。舉例來說,以前面 畫點分區的例子 來說,我們不是每個點都有 X 跟 Y 的坐標嗎? 所以它就有 兩種 attribute。假定我有兩個點:(0,3)跟(5,8)分別在 label(class)1 跟 2,那就會寫成 1 1:0 2:3 2 1:5 2:8 同理,空間中的三維坐標就等于有三組 attribute。Maybe it's confusing to you: why value, value2,...? The reason is usually the input data to the problem you were trying to solve involves lots of 'features', or say 'attributes', so the input will be a set(or say vector/array).Take the Marking points and find region example described above, we assumed each point has coordinates X and Y so it has two attributes(X and Y).To describe two points(0,3)and(5,8)as having labels(classes)1 and 2, we will write them as: 1 1:0 2:3 2 1:5 2:8 And 3-dimensional points will have 3 attributes.這種檔案格式最大的好處就是可以使用 sparse matrix,或說有些 data 的 attribute 可以不存在。This kind of fileformat has the advantage that we can specify a sparse matrix, ie.some attribute of a record can be omitted.To Run libsvm
來解釋一下 libsvm 的程序怎么用。你可以先拿 libsvm 附的 heart_scale 來做輸入,底下也以它為例: Now I'll show you how to use libsvm.You may use the heart_scale file in the libsvm source archive as input, as I'll do in this example: 看到這里你應該也了解,使用 SVM 的流程大概就是: You should have a sense that using libsvm is basically: 1.準備數據并做成指定 格式(有必要時需 svmscale)Prepare data in specified format and svmscale it if necessary.2.用 svmtrain 來 train 成 model Train the data to create a model with svmtrain.3.對新的輸入,使用 svmpredict 來 predict 新數據的 class Predict new input data with svmpredict and get the result.svmtrain
svmtrain 的語法大致就是 : The syntax of svmtrain is basically: svmtrain [options] training_set_file [model_file]
training_set_file 就是之前的格式,而 model_file 如果不給就會 叫 [training_set_file].model。options 可以先不要給。The format of training_set_files is described above.If the model_file is not specified, it'll be [training_set_file].model by default.Options can be ignored at first.下列程序執行結果會產生 heart_scale.model 檔:(屏幕輸出不是很重要,沒有錯誤就好了)The following command will generate the heart_scale.model file.The screen output may be ignored if there were no errors../svm-train heart_scale
optimization finished, #iter = 219 nu = 0.431030 obj =-100.877286, rho = 0.424632 nSV = 132, nBSV = 107 Total nSV = 132 svmpredict
svmpredict 的語法是 : The syntax to svm-predict is: svmpredict test_file model_file output_file
test_file 就是我們要 predict 的數據。它的格式跟 svmtrain 的輸入,也就是
training_set_file 是一樣的!不過每行最前面的 label 可以省略(因為 predict 就是要 predict 那個 label)。但如果 test_file 有 label 的值的話,predict 完會順便拿 predict 出來的值跟 test_file 里面寫的值去做比對,這代表: test_file 寫的 label 是真正的分類結果,拿來跟我們 predict 的結果比對就可以 知道 predict 有沒有猜對了。test_file is the data the we are going to 'predict'.Its format is almost exactly the same as the training_set_file, which we fed as input to svmtrain.But we can skip the leading label(Because 'predict' will output the label).Somehow if test_file has labels, after predicting svm-predict will compare the predicted label with the label written in test_file.That means, test_file has the real(or correct)result of classification, and after comparing with our predicted result we can know whether the prediction is correct or not.也所以,我們可以拿原 training set 當做 test_file 再丟給 svmpredict 去 predict(因為格式一樣),看看正確率有多高,方便后面調參數。So we can use the original training_set_file as test_file and feed it to svmpredict for prediction(nothing different in file format)and see how high the accuracy is so we can optimize the arguments.其它參數就很好理解了: model_file 就是 svmtrain 出來 的檔案,output_file 是存輸出結果的檔案。Other arguments should be easy to figure out now: model_file is the model trained by svmtrain, and output_file is where we store the output result.輸出的格式很簡單,每行一個 label,對應到你的 test_file 里面的各行。Format of output is simple.Each line contains a label corresponding to your test_file.下列程序執行結果會產生 heart_scale.out : The following commands will generate heart_scale.out:./svm-predict heart_scale heart_scale.model heart_scale.out Accuracy = 86.6667%(234/270)(classification)Mean squared error = 0.533333(regression)Squared correlation coefficient = 0.532639(regression)As you can see,我們把原輸入丟回去 predict,第一行的 Accuracy 就是預測的正確率了。如果輸入沒有 label 的話,那就是真的 predict 了。As you can see, after we 'predict'ed the original input, we got 'Accuracy=86.6667%“ on first line as accuracy of prediction.If we don't put labels in input, the result is real prediction.看到這里,基本上你應該已經可以利用 svm 來作事了: 你只要寫程序輸出正確格式的數據,交給 svm 去 train,后來再 predict 并讀入結果即可。Now you can use SVM to do whatever you want!Just write a program to output its data in the correct format, feed the data to SVM for training, then predct and read the output.Advanced Topics
后面可以說是一些稍微進階的部份,我可能不會講的很清楚,因為我的重點是想表達一些觀念和解釋一些你看相關文件時 很容易碰到的名詞。These are a little advanced and I may not explain very clearly.Because I just want to help you get familiar with some of the terminology and ideas that you'll encounter when you read other(lib)SVM documents.Scaling
svm-scale 目前不太好用,不過它有其必要性。因為 適當的 scale 有助于參數的選擇(后述)還有解 svm 的速度。
svmscale 會對每個 attribute 做 scale。范圍用-l,-u 指定,通常是 [0,1] 或是 [-1,1]。輸出在 stdout。
另外要注意的(常常會忘記)是 testing data 和 training data 要一起 scale。而 svm-scale 最難用的地方就是沒辦法指定 testing data/training data(不同檔案)然后一起 scale。
svm-scale is not easy to use right now, but it is important.Scaling aids the choosing of arguments(described below)and the speed of solving SVM.svmscale rescales all atrributes with the specified(by-l,-u)range, usually [0,1] or [-1,1].Please keep in mind that testing data and training data MUST BE SCALED WITH THE SAME RANGE.Don't forget to scale your testing data before you predict.We can't specify the testing and training data file together and scale them in one command, that's why svm-scale is not so easy to use right now.Arguments
前面提到,在 train 的時候可以下一些參數。(直接執行 svm-train 不指定輸入檔與參數會列出所有參數及語法說明)這些參數對應到原始 SVM 公式的一些參數,所以會影響 predict 的正確與否。舉例來說,改個 c=10:./svm-train-c 10 heart_scale
再來 predict,正確率馬上變成 92.2%(249/270)。
We know that we can use some arguments when we were training data(Running svm-train without any input file or arguments will cause it to print its list syntax help and complete arguments).These arguments corresponds to some arguments in original SVM equations so they will affect the accuracy of prediction.Let's use c=10 as an example:./svm-train-c 10 heart_scale
If you predict again now, the accuracy will be 92.2%(249/270).Cross Validation
一般而言,SVM 使用的方式(在決定參數時)常是這樣: 1.先有已分好類的一堆資料 2.隨機數拆成好幾組 training set 3.用某組參數去 train 并 predict 別組看正確率 4.正確率不夠的話,換參數再重復 train/predict Mostly people use SVM while following this workflow: 1.Prepare lots of pre-classified(correct)data 2.Split them into several training sets randomly.3.Train with some arguments and predict other sets of data to calculate the accuracy.4.Change the arguments and repeat until we get good accuracy.等找到一組不錯的參數后,就拿這組參數來建 model 并用來做最后對未知數據的 predict。這整個過程叫 cross validation,也就是交叉比對。When we got some nice arguments, we will then use them to train the model and use the model for final prediction(on unknown test data).This whole process is called cross validation.在我們找參數的過程中,可以利用 svmtrain 的內建 cross validation 功能來幫忙:-v n: n-fold cross validation
n 就是要拆成幾組,像 n=3 就會拆成三組,然后先拿 1 跟 2 來 train model 并 predict 3 以得到正確率; 再來拿 2 跟 3 train 并 predict 1,最后 1,3 train 并 predict 2。其它以此類推。In the process of experimenting with the arguments, we can use the built-in support for validation of svmtrain:-v n: n-fold cross validation
n is how many sets to split your input data.Specifing n=3 will split data into 3 sets;train the model with data set 1 and 2 first then predict data set 3 to get the accuracy, then train with data set 2 and 3 and predict data set 1, finally train 1,3 and predict 2,...ad infinitum.如果沒有交叉比對的話,很容易找到只在特定輸入時好的參數。像前面我們 c=10 得到 92.2%,不過拿-v 5 來看看:./svm-train-v 5-c 10 heart_scale...Cross Validation Accuracy = 80.3704%平均之后才只有 80.37%,比一開始的 86 還差。If we don't use cross validation, sometimes we may be fooled by some arguments only good for some special input.Like the example we used above, c=10 has 92.2%.If we do so with-v 5:./svm-train-v 5-c 10 heart_scale...Cross Validation Accuracy = 80.3704% After the prediction results is averaged with cross validation we have only 80.37% accuracy, even worse than with the original argument(86%).What arguments rules?
通常而言,比較重要的參數是 gamma(-g)跟 cost(-c)。而 cross validation(-v)的參數常用 5。Generally speaking, you will only modify two important arguments when you are using training with data: gamma(-g)and cost(-c).And cross validation(-v)is usually set to 5.cost 默認值是 1, gamma 默認值是 1/k,k 等于輸入 數據筆數。那我們怎么知道要用多少來當參數呢?
用 試 的
是的,別懷疑,就是 Try 參數找比較好的值。
cost is 1 by default, and gamma has default value = 1/k , k = number of input records.Then how do we know what value to choose as arguments? T R Y
Yes.Just by trial and error.Try 參數的過程常用 exponential 指數成長的方式來增加與減少參數的數值,也就是 2^n(2 的 n 次方)。When experimenting with arguments, the value usually increases and decreases in exponential order.i.e., 2^n.因為有兩組參數,所以等于要 try n*n=n^2 次。這個過程是不連續的成長,所以可以想成我們在一個 X-Y平面上指定的范圍內找一群格子點(grid,如果你不太明白,想成方格紙或我們把平面上所有 整數交點都打個點,就是那樣),每個格子點的 X 跟 Y 經過換算(如 2^x, 2^y)就拿去當 cost 跟 gamma 的值來 cross validation。Because we have two important arguments, we have to try n*n=n^2 times.The whole process is discontinous and can be thought of as finding the grid points on a specified region(range)of the X-Y plane(Think of marking all integer interception points on a paper).Convert each grid point's X and Y coordinate to exponential values(like 2^x, 2^y)then we can use them as value of cost and gamme for cross validation.所以現在你應該懂得 libsvm 的 python 子目錄下面 有個 grid.py 是做啥的了: 它把上面的過程自動化,在你給定的范圍內呼叫 svm-train 去 try 所有的參數值。python 是一種語言,在這里我不做介紹,因為我會了 :P(just a joke,真正原因是--這是 libsvm 的 tutorial)。grid.py 還會把結果 plot 出來,方便你尋找參數。libsvm 有很多跟 python 結合的部份,由此可見 python 是強大方便的工具。很多神奇的功能,像自動登入多臺 機器去平行跑 grid 等等都是 python 幫忙的。不過 SVM 本身可以完全不需要 python,只是會比較方便。So look for 'grid.py' in the 'python' subdirectory inside the libsvm archive.You should know what it does now: automatically execute the procedure above, try all argument values by calling svm-train within the region specified by you.Python is a programming language which I'm not going to explain here.grid.py will also plot the result graphically to help you look for good arguments.There're also many parts of libsvm powered by python, like logging into several hosts and running grids at the same time parallel.Keep in mind that libsvm can be used without python entirely.Python just only helped us to do thinks quickly.跑 grid(基本上用 grid.py 跑當然是最方便,不過 如果你不懂 python 而且覺得很難搞,那你要自己產生 參數來跑也是可以的)通常好的范圍是
[c,g]=[2^-10,2^10]*[2^-10,2^10] 另外其實 grid 用 [-8,8] 也很夠了。Running for grids(it's more convenient to just use grid.py but it's also ok if you don't)you may choose the range as [c,g]=[2^-10,2^10]*[2^-10,2^10] Usually [-8,8] is enough for grids.Regression
另一個值得一提的是 regression。
簡單來說,前面都是拿 SVM 來做分類(classification), 所以 label 的值都是 discrete data、或說已知的固定值。而 regression 則是求 continuous 的值、或說未知的值。你也可以說,一般是 binary classification, 而 regression 是可以預測一個實數。比如說我知道股市指數受到某些因素影響 , 然后我想預測股市..股市的指數就是我們的 label, 那些因素量化以后變成 attributes。以后搜集那些 attributes 給 SVM 它就會 預測出指數(可能是沒出現過的數字),這就要用 regression。那樂透開獎的號碼呢? 因為都是固定已知的數字,很明顯我們應該用一般 SVM 的 classification 來 predict。(注:這是真實的例子--llwang 就寫過這樣的東西)所以說 label 也要 scale, 用 svm-scale-y lower upper
但是比較糟糕的情況是 grid.py 不支持 regression,而且 cross validation 對 regression 也常常不是很有效。
總而言之,regression 是非常有趣的東西,不過也是比較 進階的用法。在這里我們不細談了,有興趣的人請再 參考 SVM 與 libsvm 的其它文件。The other important issue is ”Regression“.To explain briefly, we only used SVM to do classification in this tutorial.The type of label we used are always discrete data(ie.a known fixed value).”Regression“ in this context means to predict labels with continuous values(or unknown values).You can think of classification as predictions with only binary outcomes, and regression as predictions that output real(floating point)numbers.Thus to predict lottery numbers(since they are always fixed numbers)you should use classification, and to predict the stock market you need regression.The labels must also be scaled when you use regression, by svm-scale-y lower upper However grid.py does not support regression, and cross validation sometimes does not work well with regression.Regression is interesting but also advanced.Please refer to other documents for details.Epilogue
到此我已經簡單的說明了 libsvm 的使用方式,更完整的用法請參考 libsvm 的說明跟 cjlin 的網站、SVM 的相關文件,或是去上 cjlin 的課。Here we have already briefly explained the libsvm software.For complete usage guides please refer to documents inside the libsvm archive, cjlin's website , SVM-related documents, or go take cjlin's course if you are a student at National Taiwan University :)對于 SVM 的新手來說,libsvmtools 有很多好東西。像 SVM for dummies 就是很方便觀察 libsvm 流程的東西。Take a glance at libsvmtools especially ”SVM for dummies" there.Those are good tools for SVM newbies that helps in observing libsvm workflow.Copyright All rights reserved by Hung-Te Lin(林弘德, piaip),,Website: piaip at ntu csie,2003.All HTML/text typed within VIM on Solaris.Style sheet from W3C Core StyleSheets.
第二篇:合法使用說明
易制毒化學品合法使用說明
本單位XX車間后續生產使用到國家管制的二、三類易制毒化學品——硫酸和鹽酸,主要用于污水處理和實驗試劑。
預計年涉及量:硫酸10噸/年,鹽酸10升/年。
本單位保證嚴格遵守《易制毒化學品管理條例》和《易制毒化學品購銷和運輸辦法》,保證將所購買易制毒化學品全部按照合法用途使用,在任何情況下不用于制造毒品,不挪作他用,不私自轉讓給其他單位或個人,并自覺加強易制毒化學品管理,落實出入庫登記制度,自覺接受監督檢查。如有違反上述承諾,致使易制毒化學品流入非法渠道,我單位自愿接受相應處罰。
特此證明。
單位名稱(簽章):
天津XX制造有限公司
日期:
****年**月**日
第三篇:課件使用說明
課件使用說明
1、課件使用的軟件為flash8.0。
2、雙擊“兩位數加減兩位數.exe”或者“兩位數加減兩位數.swf”打開課件。
3、共14個環節,每個環節已改為自動播放,請稍等。
4、一個環節播完后,單擊右下角的5、返回上一個環節單擊左下角的按鈕可進入下個環節。按鈕。
按鈕可停止音樂。
6、第14環節(歡迎來到動物村莊),單擊右下角的7、按鍵盤上的Esc鍵,退出全屏模式,單擊關閉按鈕關閉課件。
第四篇:課件使用說明
課 件 使 用 說 明
一、課件說明
課件名稱:荷葉圓圓
年級科目:人教版一年級語文下冊
課件作者:道真自治縣三橋鎮接龍小學 王德敏 文件類型:PPT格式
二、課件使用說明
1、雙擊課件圖標打開課件封面,出示作者,單擊左鍵,出示圖片,導出課題。
2、在第2張ppt上,單擊 知故事內容,激發學生的學習興趣。
3、在第9張ppt上,單擊 鍵盤上按ESC鍵返回。
4、在第11張ppt上,單擊 圖,在鍵盤上按ESC鍵返回。
5、在第11張ppt上,單擊 鍵盤上按ESC鍵返回。
6、在第12張ppt上,在右下角單擊
7、在第14張ppt上,在右下角單擊 塘美景視頻,欣賞荷塘美景。
8、除以上7個操作之外,其余全部操作由單擊左鍵完成。
二字,播放搖籃圖,在 按鈕,播放課文動畫,感
三字,播放停機坪 字,播放動詞做游戲,在 按鈕,播放音 按鈕,播放荷樂,做角色扮演活動,單擊左鍵結束,并進入下一環節。
第五篇:規章制度使用說明
規章制度使用說明
各顧問單位負責法律事務的人員,請根據下列《企業勞動規章制度》結合本企業的實際情況,對《企業勞動規章制度》中未填寫的部分予以填充;對《企業勞動規章制度》中不適合本企業的內容,可以刪除和修改;對《企業勞動規章制度》中未涉及到的內容,可以增加補充。
經過顧問單位修改過的《企業勞動規章制度》,一定要經過職工代表大會或者職工大會討論表決通過,并予以公示。表決的結果要用書面的形式記錄下來,并作為檔案保存。企業勞動規章制度 第一章 總則
第1條 為規范企業和職工的行為,維護企業和職工雙方的合法權益,根據《中華人民共和國勞動法》、《中華人民共和國勞動合同法》及其配套法規、規章的規定,結合企業的實際情況,制定本規章制度。
第2條 本規章制度適用于企業和全體職工,職工包括管理人員、技術人員和普通職工;包括試用工和正式工;對特殊職位的職工另有規定的從其規定。
第3條 職工享有取得勞動報酬、休息休假、獲得勞動安全衛生保護,享受社會保險和福利等勞動權利,同時應當履行完成勞動任務、遵守企業規章制度和職業道德等勞動義務。第二章 工作時間與休息休假
第5條 企業實行每天工作 小時,每周工作時間不超過40小時,每周至少休息一天,對特殊崗位的職工實行不定時或綜合計時工作制。
第6條 職工每天正常上班時間為:上午 : 時— : 時,下午 :— : 時。
第7條公司根據生產需要,經與員工協商可以依法延長日工作時間和安排員工休息日(星期
六、日)加班,但每日延長工作時間一般不超過3小時,并保證員工每周至少休息一天。
第8條 員工加班加點應由部門經理、主管安排或經本人申請而由部門經理、主管批準;員工經批準加班的,依國家規定支付加班工資或安排補休。
第9條 員工的休息日和法定休假日如下:
(1)休息日: 星期
六、星期日;(2)休假日: 元旦1天、春節3天、五一節3天、國慶節3天。
(2)婚 假: 員工本人結婚,可享受婚假3天;晚婚者(男年滿25周歲、女年滿23周歲)增加10天。
(3)喪 假: 員工直系親屬(父母、配偶、子女)死亡,可享受喪假3天;員工配偶的父母死亡,經公司總經理批準,可給予3天以內的喪假。第三章 工資福利 第10條 職工工資不低于佛山市最低工資標準 元/月。第11條 企業實行計時工資和計件工資,此外包括加班工資、獎金、津貼和補貼。獎金和生活補貼不列入工資。計時工資和計件工資以勞動合同約定或單價協議書為準。
第12條 安排職工加班的,企業按國家有關規定支付加班工資。第13條 休息日安排職工加班,企業可以安排職工補休而不支付加班工資。
第14條 因職工原因給企業造成經濟損失的,企業可以要求職工賠償或依企業規章制度對職工罰款的,可從職工當月工資中扣除。罰款和賠償可以同時執行,但每月扣除的不超過職工工資的20%,扣除后余額工資不低于最低工資標準 770 元。
第15條 有下列情況之一,企業可以代扣或減發職工工資而不屬于克扣工資:
(1)代扣代繳員工個人所得稅;(2)代扣代繳員工個人負擔的社會保險費、住房公積金;(3)法院判決、裁定中要求代扣的撫養費、贍養費;(4)扣除依法賠償給公司的費用;(5)、扣除員工違規違紀受到公司處罰的罰款;(6)勞動合同約定的可以減發的工資;(7)依法制定的公司規章制度規定可以減發的工資;(8)經濟效益下浮而減發的浮動工資;(9)員工請事假而減發的工資;(10)法律、法規、規章規定可以扣除的工資或費用。
第四章 勞動安全衛生與勞動保護
第16條 公司努力貫徹安全第一、預防為主的方針,為員工提供符合國家規定的勞動安全衛生條件和必要的勞動防護用品,對從事有職業危害作業的員工和未成年工定期進行檢查。第17條 公司對員工進行安全生產教育和培訓,使員工具備必要的安全生產意識,熟悉安全生產制度和安全操作規程,掌握本崗位的安全操作技能。
第18條 公司實行安全生產責任制,部門經理(或部門主管)對本部門的安全問題負責,法定代表人(或總經理、安全主任)對全公司的安全問題負責。
第19條 公司對女職工和未成年工實行特殊勞動保護,不安排女職工和未成年工從事法律、法規禁止的勞動。第五章 勞動紀律與員工守則
第20條 員工必須遵守如下考勤和辭職制度:
(1)按時上班、下班,不得遲到、早退;(2)必須自己打卡,不得委托他人打卡或代替他人打卡;(3)因公外出、漏打、錯打等特殊原因未能打卡的,必須由本部門經理或主管簽卡方能有效;(4)有事、有病必須向部門經理或主管請假,不得無故曠工;(5)請假必須事先填寫《請假單》,并附上相關證明(病假應有醫生證明),在不得已的情況下,應提早電話、電報或委托他人請假,上班后及早補辦請假手續;(6)一次遲到或早退20分鐘以上的,應辦理請假手續,否則以曠工論處(7)未履行 請假、續假、補假手續而擅不到崗者,均以曠工論處;(8)員工因故辭職,應提前一個月向部門經理或主管提交《辭職通知書》,試用期內辭職應提前三天書面通知;(9)員工辭職由部門經理或主管批準,辭職獲準后,憑人事行政部簽發的《離職通知書》辦理移交手續。
第21條 員工必須遵守如下工作守則和職業道德:
(1)進入或逗留廠區,必須按規定佩戴廠證和穿著工作服;
(2)服從公司的正常調動和工作安排;
(3)嚴格遵守公司的各項規章制度、安全生產操作規程和崗位責任制;
(4)工作期間,不消極怠工,不干私活,不串崗,不吃零食,不打鬧嬉戲,不大聲說笑、喧嘩,不打瞌睡等;
(5)不隨地吐痰,不亂丟煙頭雜物;
(6)愛護公物,小心使用公司機器設備、工具、物料,不得盜竊、貪污或故意損壞公司財物;
(7)節約用水、用電、用氣,嚴禁浪費公物和公物私用;
(8)不得無理取鬧、打架斗毆、造謠生事;
(9)關心公司,維護公司形象,敢于同有損公司形象和利益的行為作斗爭。
(10)上班時間一到即刻開始工作,下班之后無特別事務不得逗留;
(11)上班時間原則上不準會客和打私人電話,因故而經部 門經理或主管許可的除外;
(12)遵守公司的保密制度,不得泄露公司的商業秘密。
第24條 員工必須遵守如下安全守則和操作規程:
(1)生產主管和領班要做好機器設備的保養、維修和用前檢查工作,在確保機器設備可安全使用后,方可投入使用;
(2)操作機器設備時,必須嚴格遵守技術操作規程,保證產品質量,維護設備安全及保障人身的安全;
(3)設備使用過程中,如發現有異常情況,操作工應及時告知領班和相關技術人員處理,不得擅自盲目動作;
(4)發現直接危及人身安全的緊急情況,要立即采取應急措施,并及時將情況向領班、部門主管或部門經理報告;
(5)工作場所和倉庫的消防通道,必須經常保持暢通,不得放置任何物品;
(6)對消防設備、衛生設備及其他危險防止設備,不得有隨意移動、撤走及減損其效力的行為;
(7)、維修機器、電器、電線必須關閉電源或關機,并由相關技術人員或電工負責作業;
(8)非機械設備的操作人員,不得隨意操作機械設備;
(9)危險物品必須按規定放置在安全的地方,不得隨意亂放;
(10)車間和倉庫嚴禁吸煙,吸煙要在指定場所,并充分注意煙火。
(11)嚴禁攜帶易燃易爆、有毒有害的危險物品進入公司;
(12)收工時要整理機械、器具、物料及文件等,確認火、電、氣的安全,關好門窗、上好門鎖。第六章 獎勵與懲罰
第22條 為增強職工責任感,調動職工積極性和創造性,提高勞動生產率和工作效率,企業對表現優秀、成績突出的職工實行獎勵制度。獎勵分為表揚、晉升、獎金三種。
第23條 職工品行端正,工作努力,忠于職守、遵規守紀,關心企業,服從安排,成為職工楷模者,給予通報表揚。
第24條 對有下列事跡之一的職工,除給予通報表揚外,另給予晉升、獎金的獎勵:(1)對于生產技術或管理制度,提出具體方案,經執行確有成效,能提高企業經濟效益,對企業貢獻較大的;(2)節約物料,或對廢料利用具有成效,能提高企業經濟效益,對企業貢獻較大的;(3)遇有災情,勇于負責,奮不顧身,處置得當,極力搶救,使企業利益免受重大損失的;(4)敢于同壞人、壞事作斗爭,舉報損害企業利益行為,使企業避免重大損失的;(5)其他應當給予獎勵的。
第25條 為維護正常的生產秩序和工作秩序,嚴肅廠規廠紀,公司對違規違紀員工實行懲罰制度。
懲罰分為:警告、記過、罰款、解除勞動合同四種。第26條 員工有下列情形之一,經查證屬實,批評教育無效的,7 第一次口頭警告,第二次以后每次書面警告1次,并罰款20至50元;每警告2次記過1次;一個月內被記過3次以上或一年內被記過6次以上的,屬于嚴重違反企業規章制,予以解除勞動合同:
(1)委托他人打卡或代替他人打卡的;
(2)無正當理由經常遲到或早退(每次3分鐘以上)的;
(3)不戴廠證或不穿廠服進入廠區的;
(4)擅離職守或串崗的(5)消極怠工,上班干私活的;
(6)隨地吐痰或亂丟垃圾,污染環境衛生的;
(7)未經批準,上班時間會客或打私人電話的;
(8)下班后不按規定關燈、關電、關水、關氣、關窗、鎖門的;
(9)未經許可擅帶外人入廠參觀的;
(10)隨意移動消防設備或亂放物品,阻塞消防通道的;
(11)違反公司規定攜帶物品進出廠區的;
(12)工作時間,與別人閑聊、打鬧嬉戲、大聲喧嘩的;
(13)工作時間打瞌睡的;
(14)對客戶的態度惡劣的;
(15)有其他與上述情形情節相當的情形的。
第27條 員工有下列情形之一,經查證屬實,批評教育無效的,每次記過1次,并罰款50至100元;一個月內被記過3次以上 或一年內被記過6次以上的,屬于嚴重違反企業規章制,予以解除勞動合同:
(1)無正當理由不服從公司正常調動或上司的工作安排的;
(2)無理取鬧,打架斗毆,影響公司生產秩序和員工生活秩序的;
(3)上班時間打牌、下棋的;
(4)在宿舍私接電源或使用電爐的;
(5)私自調換床位或留宿外人的;
(6)浪費公司財物或公物私用的;
(7)非機械設備的操作者,隨意操作機械設備的;(8)攜帶危險物品入廠的;
(9)在禁煙區吸煙的;
(10)有其他與上述情形情節相當的情形的。
第28條 員工有下列情形之一,經查證屬實,批評教育無效的,屬于嚴重違反企業規章制,予以解除勞動合同:
(1)一個月內累計曠工超過 日或者一年內累計曠工超過 日的;
(2)提供與錄用有關的虛假證書或勞動關系狀況證明,騙取公司錄用的;
(3)違反操作規程,損壞機器設備、工具,浪費原材料,造成公司經濟損失 元以上的;
(4)盜竊、貪污、侵占或故意損壞公司財物,造成公司經 濟損失 元以上的;
(5)違反公司保密制度,泄露公司商業秘密,造成公司經濟損失 元以上的;
(6)在異性宿舍與異性員工同宿的;
(7)利用工作或職務便利,收受賄賂而使公司利益受損的;
(8)有其他與上述情形情節相當的情形的。
第29 條:職工違規違紀對企業造成經濟損失,除按規定處罰外,還應賠償相應經濟損失。
第30條 對職工的違紀處理,由違紀職工所在的車間主任根據本規章制度相關條款提出書面處理意見,并提交人事部門,再由人事部門提交總經理室審批。經批準后,由人事部門向違紀職工送達處理決定書,處理決定必須包括職工違紀事實、違紀證據、處理原因、處理依據、處理結果等五項內容。整個處理過程不得超過30日。
第31條 職工對企業處理不服的,享有申訴權利。申訴程序:第一步向車間主任申辯事實與理由;第二步對車間主任再次處理不服的,向人事部門申辯事實與理由;第三步對人事部門再次處理不服的,向總經理室申辨事實與理由,總經理室作出的再次處理決定為本企業最終處理決定。第七章 保密制度與競業限制
第32條 為了維護企業利益,保護企業的商業秘密,特制訂本保 密制度,企業全體職工必須嚴格遵守。
第33條 本規定所稱的商業秘密是指不為公眾所知悉,能為企業帶來經濟利益,具有實用性并經企業采取保密措施的技術信息和經營信息,以及企業依法律規定或者有關協議的約定,對外承擔保密義務的事項。
第34條 可能成為企業商業秘密的技術信息包括技術方案、工程設計、制造方法、配方、工藝流程、技術指標、計算機軟件、實驗數據、實驗結果、圖紙、樣品、模型、模具、技術文檔、操作手冊等等。
第35條 可能成為企業商業秘密的經營信息包括客戶名單、客戶訂單、營銷計劃、采購資料、財務資料、進貨渠道、產銷策略、經營目標、經營項目、管理訣竅、貨源情報、內部文件、會議紀要、經濟合同、合作協議等等。
第36條 嚴格遵守企業秘密文件、資料、檔案的登記、借用和保密制度,秘密文件應存放在有保密設施的文件柜中,借用秘密文件、資料、檔案須經總經理或辦公室主任批準;不得在公共場所談論企業秘密事項和交接秘密文件。
第37條 秘密文件、資料、檔案不得私自復印、摘錄和外傳。因工作需要復印時,應按有關規定經總經理或辦公室主任批準。第38條 職工調職或離職時,必須將自己保管的秘密文件、資料、電子資料、檔案或其他東西,按規定移交給企業總經理或辦公室 主任,不得隨意移交給其他人員。未辦移交或者移交不清的,公司可以暫不予結算最后的工資。
第39條 企業根據實際情況和需要,與知悉或可能知悉企業商業秘密的職工另行簽訂《保密協議》,協議內容包括保密的內容、范圍、權利、義務、期限、保密費和違約責任等事項。第57條 未經企業同意,職工在職期間不得自營或者為他人經營與企業同類的營業。
第40條 企業根據實際情況和需要,與知悉或可能知悉企業商業秘密的職工另行簽訂《競業限制協議》,約定職工從離開企業后的一定期限和一定范圍內,不得在生產同類且有競爭關系的產品的其他企業內任職。,本規定與現行勞動法律、法規、規章有抵觸的,以現行勞動法律、法規、規章的規定為準。第41條 本規章制度未盡事宜,另行規定。
第42條 本規章制度已由職工代表大會(或全體職工)討論和審議通過,并張榜公布。
第43條 本規章制度自 年 月 日生效。
(單位公章)
年 月 日