Comments (1)
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)
- CH12: Custom Models: number of iterations for lower Residual Block HOT 1
- [BUG] Chapter 10: KerasRegressor vs Sci-Keras issue
- Where Can I find Appendix A? Is it in book or files? If files where? HOT 1
- [QUESTION] Chapter 14 error
- [BUG] [Chapter2] ValueError when calculating the correlations in corr_matrix = housing.corr() HOT 3
- [BUG] Chapter 4, Notebook: 04_training_linear_models.ipynb, Cell 47 HOT 4
- I get "TypeError: 'module' object is not subscriptable" for cm module HOT 2
- [BUG] 'my_mnist.data' HOT 1
- Chapter 10 neither attribute keras.wrapper nor keras.__version__ being found :/ HOT 1
- [QUESTION] Chapter 10 Exercise 10 Factor parameter HOT 1
- [QUESTION]What is the difference between predict_proba, decision_function and predict function and how to choose HOT 1
- [BUG] HOT 1
- [BUG]sgd_reg = SGDRegressor(max_iter=1, tol=-np.infty, warm_start=True, penalty=None, learning_rate="constant", eta0=0.0005, random_state=42)
- [BUG]X = iris["data"][:, 3:] # petal width y = (iris["target"] == 2).astype(np.int) # 1 if Iris virginica, else 0
- [BUG]09 unsupervised learning
- [QUESTION] Chapter 10 RandomizedSearchCV returned best model having worse performance. HOT 1
- [QUESTION] Chapter 2 StratfiedShuffleSplit
- Machine Learning
- [BUG] [Chapter 4]: Equation rendering issue in "exercise 12" solution in 04_training_linear_models.ipynb
- [QUESTION] About Cross-Validation in Chapter2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handson-ml2.