cjlin1 / libsvm

LIBSVM -- A Library for Support Vector Machines
https://www.csie.ntu.edu.tw/~cjlin/libsvm/
BSD 3-Clause "New" or "Revised" License
4.52k stars 1.64k forks source link

svm-scale returns an empty feature file in case of a single instance #178

Closed MTawfik93 closed 2 years ago

MTawfik93 commented 2 years ago

Hello, I did train a 3 classes model using RBF kernel with 13 features and 1104 instances which is attached as "Full_Train.txt" and when scaled between -1 and 1 it succeeds but it scales on the y-axis "Full_Train_scaled.txt". And when I scale a file with a single detection or instance during deployment "Classify.txt" it returns an empty feature file with only the label left "Classify_scale.txt".

The command I'm using

 ./svm-scale -l -1 -u 1 Classify.txt>Classify_scale.txt

If you can please tell me if I'm doing something wrong or how to scale over the feature array and produce a scaled single instance file.

Thanks in Advance.

cjlin1 commented 2 years ago

it's correct. This means the instance is scaled to the zero vector

On 2021-09-20 17:49, MTawfik wrote:

Hello, I did train a 3 classes model using RBF kernel with 13 features and 1104 instances which is attached as "Full_Train.txt [1]" and when scaled between -1 and 1 it succeeds but it scales on the y-axis "Full_Train_scaled.txt [2]". And when I scale a file with a single detection or instance during deployment "Classify.txt [3]" it returns an empty feature file with only the label left "Classify_scale.txt [4]".

The command I'm using

./svm-scale -l -1 -u 1 Classify.txt>Classify_scale.txt

If you can please tell me if I'm doing something wrong or how to scale over the feature array and produce a scaled single instance file.

Thanks in Advance.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [5], or unsubscribe [6]. Triage notifications on the go with GitHub Mobile for iOS [7] or Android [8]. [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/178", "url": "https://github.com/cjlin1/libsvm/issues/178", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/libsvm/files/7194722/Full_Train.txt [2] https://github.com/cjlin1/libsvm/files/7194784/Full_Train_scaled.txt [3] https://github.com/cjlin1/libsvm/files/7194805/Classify.txt [4] https://github.com/cjlin1/libsvm/files/7194813/Classify_scale.txt [5] https://github.com/cjlin1/libsvm/issues/178 [6] https://github.com/notifications/unsubscribe-auth/ABI3BHX2AJGHYQEEZNEBBOTUC37T5ANCNFSM5ELSDXEQ [7] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [8] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

MTawfik93 commented 2 years ago

Well, when I scale a group of instances together, they produce the scaled values not equal to zero vector, but when I scale only one instance of them alone, the scaled values are zero vector, so why is this happening?

cjlin1 commented 2 years ago

If the input is a set with many instances we can calculate max/min of each feature.. But this isn't the case for a single instance

On 2021-09-20 18:38, MTawfik wrote:

Well, when I scale a group of instances together, they produce the scaled values not equal to zero vector, but when I scale only one instance of them alone, the scaled values are zero vector, so why is this happening?

-- You are receiving this because you commented. Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. Triage notifications on the go with GitHub Mobile for iOS [3] or Android [4]. [ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/cjlin1/libsvm/issues/178#issuecomment-922810806", "url": "https://github.com/cjlin1/libsvm/issues/178#issuecomment-922810806", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Links:

[1] https://github.com/cjlin1/libsvm/issues/178#issuecomment-922810806 [2] https://github.com/notifications/unsubscribe-auth/ABI3BHSD5ZR5S7O24PA7HJ3UC4FJNANCNFSM5ELSDXEQ [3] https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 [4] https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub

MTawfik93 commented 2 years ago

Ok Thanks for your help.