Code Monkey home page Code Monkey logo

nusdbsystem / arm-net Goto Github PK

View Code? Open in Web Editor NEW
67.0 11.0 13.0 24.7 MB

A ready-to-use framework of the state-of-the-art models for structured (tabular) data learning with PyTorch. Applications include recommendation, CRT prediction, healthcare analytics, anomaly detection, and etc.

License: Apache License 2.0

Python 95.03% Shell 4.97%
tabular-data structured-data pytorch attention frappe-dataset movielens-dataset avazu-dataset criteo-dataset diabetes-prediction healthcare-analysis

arm-net's People

Contributors

solopku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arm-net's Issues

Multiple output neurons (multiclass classification) support

Hi!

How to correctly support multiple output neurons in your models (for example for multiclass classification task)?

  1. armnet and armnet_1h support multiple output neurons via noutput parameter - there is no problem.

  2. For some models, I added support for multiple output neurons by explicitly specifying the noutput parameter in the last MLP-layer, or by adding support for multiple output neurons for the Linear as follows:

class Linear(nn.Module):

    def __init__(self, nfeat, noutput=1):
        super().__init__()
        self.noutput = noutput
        self.weight = nn.Embedding(nfeat, noutput)
        self.bias = nn.Parameter(torch.zeros((1,)))

    def forward(self, x):
        """
        :param x:   {'id': LongTensor B*F, 'value': FloatTensor B*F}
        :return:    linear transform of x
        """
        wights = self.weight(x['id'])
        linear = []
        for i in range(self.noutput):
            a_i = wights[:, :, i]
            a_i_mul_b_i = torch.mul(a_i, x['value'])
            linear.append(a_i_mul_b_i)
        linear = torch.stack(linear, dim=2)

        val = torch.sum(linear, dim=1) + self.bias

        return val

The following models can be adjusted in this way: lr, dnn, afn, gc_arm, dcn, cin, nfm, xdfm, ipnn, kpnn, wd, gat, gcn, dcn+, sa_glu.

  1. It is not quite clear how to add support for multiple output neurons for the following models: dfm, fm, hofm, afm because of it is unclear how to modify FactorizationMachine for multiple output.

Could you please comment on the correctness of changing the Linear layer from (2), and how to add support for multiple output neurons for models from (3)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.