应用分位数变换的keras层及其逆

FastQuantileLayer的Python项目详细描述


快速量化层

FastQuantileLayer是Keras实现分位数转换的层 类似于scikit学习量子位变换器。 类似的实现,更精确但不局限于keras,可以在这里找到: https://github.com/yandexdataschool/QuantileTransformerTF/blob/master/README.md

此套餐的目的是:

  • 删除对scikit learn的所有依赖项
  • 尽可能快地获得正变换和反变换的求值 (以某种精度换取性能)
  • 在keras中获得序列模型中可运行的tensorflow图

包由两个类组成:

  • fixedbininterpolator:用于插入点定义函数 y=f(x),等距x采样(x网格)
  • fastQuantileLayer:用于计算要预处理的转换 将数据输入到均匀分布或正态分布的变量中。

路缘石外示例

  ## Creates the training dataset 
  dataset = np.random.uniform ( 0., 1., 1000 ) 

  ## Train the QuantileTransformer 
  transformer = FastQuantileLayer (output_distribution='normal')
  transformer . fit ( dataset ) 

  ## Gets a new dataset with the same distribution as the training dataset
  test_dataset = tf.constant(np.random.uniform ( 0., 1., 100000 ))

  ## Transform the variable into a Gaussian-distributed variable t 
  t = transformer . transform ( test_dataset ) 

  [...] 

  ## Appiles the inverted transform to the Gaussian distributed variable t  
  bkwd = transformer . transform ( t, inverse=True ) 

  ## bkwd differs from test_dataset only for computational errors 
  ## (order 1e-5) that can be reduced tuning the arguments of QuantileTransformer

路缘石内的示例

  ## Creates the training dataset 
  dataset = np.random.uniform ( 0., 1., 1000 ) 

  model = tf.keras.models.Sequential()
  model.add ( FastQuantileLayer ( output_distribution = 'normal' ).fit ( dataset ) )
  model.add ( Dense ( 10, activation = 'tanh' ) )
  model.add ( Dense ( 1, activation = 'sigmoid' ) ) 


欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java我想读取一个带分隔符的或csv文件,并将相应的值保存在postgres DB中   java ANT在解压任务期间连接文件   java Log4j在一行中打印嵌套异常   解压缩HTTPInputStream时,java GZIPInputStream过早关闭   java如何在GWTExt的GridPanel中的标题下放置子标题?   java词典快速排序   dll管理JAVA中的非托管代码?   java无法通过我的Springboot Servlet应用程序使用SAAJ从SOAP消息获取附件   用Java更新MySQL表   java Json格式错误,当他已经得到一个数组时请求数组   Spring数据REST中资源所有权对java的限制   java Vaadin布局扩展   java使用jsoup获取元素外部但元素旁边的文本   java使用javax从GMail获取消息的UID。用IMAP发送邮件   Java中数字到单词的转换模块   java如何减少拨号表中的字体大小   java垃圾值>��� 在springmvc中对swaggerui(io.swagger)的描述中,如何删除它?