Group CLI demo into subdirectory. (#6258)
CLI is not most developed interface. Putting them into correct directory can help new users to avoid it as most of the use cases are from a language binding.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
../../xgboost mq2008.conf
|
||||
|
||||
../../xgboost mq2008.conf task=pred model_in=0004.model
|
||||
|
||||
@@ -7,7 +7,7 @@ def save_data(group_data,output_feature,output_group):
|
||||
output_group.write(str(len(group_data))+"\n")
|
||||
for data in group_data:
|
||||
# only include nonzero features
|
||||
feats = [ p for p in data[2:] if float(p.split(':')[1]) != 0.0 ]
|
||||
feats = [ p for p in data[2:] if float(p.split(':')[1]) != 0.0 ]
|
||||
output_feature.write(data[0] + " " + " ".join(feats) + "\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
@@ -18,7 +18,7 @@ if __name__ == "__main__":
|
||||
fi = open(sys.argv[1])
|
||||
output_feature = open(sys.argv[2],"w")
|
||||
output_group = open(sys.argv[3],"w")
|
||||
|
||||
|
||||
group_data = []
|
||||
group = ""
|
||||
for line in fi:
|
||||
@@ -38,4 +38,3 @@ if __name__ == "__main__":
|
||||
fi.close()
|
||||
output_feature.close()
|
||||
output_group.close()
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
#!/bin/bash
|
||||
wget https://s3-us-west-2.amazonaws.com/xgboost-examples/MQ2008.rar
|
||||
unrar x MQ2008.rar
|
||||
mv -f MQ2008/Fold1/*.txt .
|
||||
if [ -f MQ2008.rar ]
|
||||
then
|
||||
echo "Use downloaded data to run experiment."
|
||||
else
|
||||
echo "Downloading data."
|
||||
wget https://s3-us-west-2.amazonaws.com/xgboost-examples/MQ2008.rar
|
||||
unrar x MQ2008.rar
|
||||
mv -f MQ2008/Fold1/*.txt .
|
||||
fi
|
||||
|
||||
python trans_data.py train.txt mq2008.train mq2008.train.group
|
||||
|
||||
|
||||
Reference in New Issue
Block a user