Giter Site home page Giter Site logo

Comments (1)

ageron avatar ageron commented on May 17, 2024

Hi @thopv133802 ,
Thanks for your question. I'm not sure whether these are tuples or shapes, and whether x represents features and y represent labels, and I don't know whether x, y_in, y_length and y_out are integers or NumPy arrays, or Tensors, or arbitrary objects.

Could you please clarify? Ideally, please provide a full example, up to the error that you are getting.

If you're talking about tuples, then it's super easy:

x = 1
y_in = 2
y_length = 3
y_out = 4
dataset = (x, y_in, y_length, y_out)
new_data=(dataset[:3], dataset[-1])
# or just:
new_data=((x, y_in, y_length), y_out)

If you are talking about shapes, then consider a simpler example:

import numpy as np
a = np.array([[[1,2,3],[4,5,6]], [[7,8,9],[10,11,12]]])
print(a.shape) # prints (2, 2, 3)

That's a 3D array. Now suppose that I want to have instead two arrays, one with shape (2, 2) and the other with shape (3,). You would end up with a 2D array and a 1D array. There's really no way to do that, at least not without losing information. Indeed, the 3D array contains 223 elements, which is 12. But after the change, we would have a 2D array with just 2*2=4 elements and a 1D array with just 3 elements, so that's a total of 12 elements.

from handson-ml2.

Related Issues (20)

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.