久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='Ba3p4'><tr id='Ba3p4'><dt id='Ba3p4'><q id='Ba3p4'><span id='Ba3p4'><b id='Ba3p4'><form id='Ba3p4'><ins id='Ba3p4'></ins><ul id='Ba3p4'></ul><sub id='Ba3p4'></sub></form><legend id='Ba3p4'></legend><bdo id='Ba3p4'><pre id='Ba3p4'><center id='Ba3p4'></center></pre></bdo></b><th id='Ba3p4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Ba3p4'><tfoot id='Ba3p4'></tfoot><dl id='Ba3p4'><fieldset id='Ba3p4'></fieldset></dl></div>

  • <tfoot id='Ba3p4'></tfoot>

        • <bdo id='Ba3p4'></bdo><ul id='Ba3p4'></ul>

        <small id='Ba3p4'></small><noframes id='Ba3p4'>

      1. <legend id='Ba3p4'><style id='Ba3p4'><dir id='Ba3p4'><q id='Ba3p4'></q></dir></style></legend>

        加載 svmlight 格式錯誤

        Load svmlight format error(加載 svmlight 格式錯誤)
        <tfoot id='Tygne'></tfoot>
        <legend id='Tygne'><style id='Tygne'><dir id='Tygne'><q id='Tygne'></q></dir></style></legend>
          <bdo id='Tygne'></bdo><ul id='Tygne'></ul>

          <small id='Tygne'></small><noframes id='Tygne'>

            <tbody id='Tygne'></tbody>

              1. <i id='Tygne'><tr id='Tygne'><dt id='Tygne'><q id='Tygne'><span id='Tygne'><b id='Tygne'><form id='Tygne'><ins id='Tygne'></ins><ul id='Tygne'></ul><sub id='Tygne'></sub></form><legend id='Tygne'></legend><bdo id='Tygne'><pre id='Tygne'><center id='Tygne'></center></pre></bdo></b><th id='Tygne'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Tygne'><tfoot id='Tygne'></tfoot><dl id='Tygne'><fieldset id='Tygne'></fieldset></dl></div>
                • 本文介紹了加載 svmlight 格式錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  當我嘗試將 svmlight python 包 與我已轉換為 svmlight 格式的數據一起使用時我得到一個錯誤.它應該是非常基本的,我不明白發生了什么.代碼如下:

                  When I try to use the svmlight python package with data I already converted to svmlight format I get an error. It should be pretty basic, I don't understand what's happening. Here's the code:

                  import svmlight
                  training_data = open('thedata', "w")
                  model=svmlight.learn(training_data, type='classification', verbosity=0)
                  

                  我也試過了:

                  training_data = numpy.load('thedata')
                  

                  training_data = __import__('thedata')
                  

                  推薦答案

                  一個明顯的問題是您在打開數據文件時會截斷它,因為您指定了寫入模式 "w".這意味著將沒有要讀取的數據.

                  One obvious problem is that you are truncating your data file when you open it because you are specifying write mode "w". This means that there will be no data to read.

                  無論如何,如果您的數據文件類似于此 example,因為是python文件,所以需要導入.這應該有效:

                  Anyway, you don't need to read the file like that if your data file is like the one in this example, you need to import it because it is a python file. This should work:

                  import svmlight
                  from data import train0 as training_data    # assuming your data file is named data.py
                  # or you could use __import__()
                  #training_data = __import__('data').train0
                  
                  model = svmlight.learn(training_data, type='classification', verbosity=0)
                  

                  您可能希望將您的數據與示例的數據進行比較.

                  You might want to compare your data against that of the example.

                  數據文件格式明確后編輯

                  輸入文件需要被解析成這樣的元組列表:

                  The input file needs to be parsed into a list of tuples like this:

                  [(target, [(feature_1, value_1), (feature_2, value_2), ... (feature_n, value_n)]),
                   (target, [(feature_1, value_1), (feature_2, value_2), ... (feature_n, value_n)]),
                   ...
                  ]
                  

                  svmlight 包似乎不支持讀取 SVM 文件格式的文件,并且沒有任何解析功能,因此必須在 Python 中實現.SVM 文件如下所示:

                  The svmlight package does not appear to support reading from a file in the SVM file format, and there aren't any parsing functions, so it will have to be implemented in Python. SVM files look like this:

                  <target> <feature>:<value> <feature>:<value> ... <feature>:<value> # <info>
                  

                  所以這里有一個解析器,可以將文件格式轉換為 svmlight 包所需的格式:

                  so here is a parser that converts from the file format to that required by the svmlight package:

                  def svm_parse(filename):
                  
                      def _convert(t):
                          """Convert feature and value to appropriate types"""
                          return (int(t[0]), float(t[1]))
                  
                      with open(filename) as f:
                          for line in f:
                              line = line.strip()
                              if not line.startswith('#'):
                                  line = line.split('#')[0].strip() # remove any trailing comment
                                  data = line.split()
                                  target = float(data[0])
                                  features = [_convert(feature.split(':')) for feature in data[1:]]
                                  yield (target, features)
                  

                  你可以這樣使用它:

                  import svmlight
                  
                  training_data = list(svm_parse('thedata'))
                  model=svmlight.learn(training_data, type='classification', verbosity=0)
                  

                  這篇關于加載 svmlight 格式錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                    <tfoot id='FYNtK'></tfoot>
                      <tbody id='FYNtK'></tbody>

                      <legend id='FYNtK'><style id='FYNtK'><dir id='FYNtK'><q id='FYNtK'></q></dir></style></legend>

                      <small id='FYNtK'></small><noframes id='FYNtK'>

                    1. <i id='FYNtK'><tr id='FYNtK'><dt id='FYNtK'><q id='FYNtK'><span id='FYNtK'><b id='FYNtK'><form id='FYNtK'><ins id='FYNtK'></ins><ul id='FYNtK'></ul><sub id='FYNtK'></sub></form><legend id='FYNtK'></legend><bdo id='FYNtK'><pre id='FYNtK'><center id='FYNtK'></center></pre></bdo></b><th id='FYNtK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FYNtK'><tfoot id='FYNtK'></tfoot><dl id='FYNtK'><fieldset id='FYNtK'></fieldset></dl></div>
                          • <bdo id='FYNtK'></bdo><ul id='FYNtK'></ul>
                            主站蜘蛛池模板: 午夜欧美 | 亚洲黄色片免费观看 | 99精品电影 | 亚洲xxxxx | 麻豆精品国产91久久久久久 | 九九亚洲| 伊人国产精品 | 久久精品国产亚洲a | 香蕉av免费| 日韩精品一区二区三区在线播放 | 午夜精品一区二区三区在线播放 | 亚洲视频欧美视频 | 亚洲一区二区免费看 | 国产色视频网站 | 亚洲视频在线免费观看 | 在线观看亚洲专区 | 欧美日韩一区二区三区四区 | 天堂综合网久久 | 不卡一二区| 国产一区精品 | 一区二区三区久久 | 国产亚洲精品91 | 日韩一二区在线观看 | 一级二级三级在线观看 | 成人h动漫精品一区二区器材 | 久久久91精品国产一区二区精品 | 国产伊人久久久 | 国内久久精品 | 亚洲一区二区免费视频 | 天天干免费视频 | 97精品国产97久久久久久免费 | 久久久久一区 | 日韩美女爱爱 | 亚洲成人综合在线 | 国产精品夜色一区二区三区 | 欧美成人一区二区三区 | 福利视频一区二区 | 日韩a在线 | 蜜臀网 | 成人在线中文字幕 | www.99re|