Comments (4)
@loretoparisi
Preds: 0 1 2 3 4 5
214536502 0.016009 0.016079 0.005016 0.005016 0.029079 0.022866
214536500 0.010071 0.010108 0.004129 0.004129 0.017137 0.013778
214536506 0.008890 0.008934 0.001951 0.001951 0.017141 0.013218
the column name is its id in batch, you need to rename this id to specific session_id.
from gru4rec.
[UPDATE]
With the code above I get an error
Epoch0 loss: 0.979422
Measuring Recall@19 and MRR@19
Recall@20: 0.007334788364521092
MRR@20: 0.0011454641877874099
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 884, in __call__
self.fn() if output_subset is None else\
IndexError: Index out of bounds.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run_rsc15.py", line 54, in <module>
preds = gru.predict_next_batch(iters, in_idx, predict_for_item_ids, batch_size)
File "../../gru4rec.py", line 600, in predict_next_batch
preds = np.asarray(self.predict(in_idxs)).T
File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 898, in __call__
storage_map=getattr(self.fn, 'storage_map', None))
File "/usr/local/lib/python3.5/dist-packages/theano/gof/link.py", line 325, in raise_with_op
reraise(exc_type, exc_value, exc_trace)
File "/usr/local/lib/python3.5/dist-packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 884, in __call__
self.fn() if output_subset is None else\
IndexError: Index out of bounds.
Apply node that caused the error: GpuAdvancedSubtensor1(<GpuArrayType<None>(float64, (False, False))>, GpuContiguous.0)
Toposort index: 9
Inputs types: [GpuArrayType<None>(float64, (False, False)), GpuArrayType<None>(int64, (False,))]
Inputs shapes: [(37483, 3), (50,)]
Inputs strides: [(24, 8), (8,)]
Inputs values: ['not shown', 'not shown']
Outputs clients: [[InplaceGpuDimShuffle{1,0}(GpuAdvancedSubtensor1.0)]]
that is a IndexError: Index out of bounds.
.
from gru4rec.
I did a step forward in selecting session_ids
, input_item_ids
.
batch_size=10
session_ids = valid.SessionId.values[0:batch_size]
input_item_ids = valid.ItemId.values[0:batch_size]
predict_for_item_ids = None
print('session_ids: {}'.format(session_ids))
print('input_item_ids: {}'.format(input_item_ids))
print('uniq_out: {}'.format(uniq_out))
print('predict_for_item_ids: {}'.format(predict_for_item_ids))
preds = gru.predict_next_batch(session_ids, input_item_ids, predict_for_item_ids, batch_size)
preds.fillna(0, inplace=True)
print('Preds: {}'.format(preds))
So far I get the dimension error for the predict_for_item_ids
doing
out_idx = valid.ItemId.values[0:batch_size]
uniq_out = np.unique(np.array(out_idx, dtype=np.int32))
predict_for_item_ids = np.hstack([data, uniq_out[~np.in1d(uniq_out,data)]])
so I'm just using predict_for_item_ids=None
.
Given this I get
session_ids: [0 1 2 3 4 5 6 7 8 9]
input_item_ids: [214696432 214857030 214858854 214858854 214836819 214696434 214857570
214858847 214859094 214690730]
uniq_out: [214690730 214696432 214696434 214836819 214857030 214857570 214858847
214858854 214859094]
predict_for_item_ids: None
and a prediction ndarray of [37483 rows x 10 columns]
, that is like:
Preds: 0 1 2 3 4 5 \
214536502 0.016009 0.016079 0.005016 0.005016 0.029079 0.022866
214536500 0.010071 0.010108 0.004129 0.004129 0.017137 0.013778
214536506 0.008890 0.008934 0.001951 0.001951 0.017141 0.013218
Not sure about the dimension of this array actually.
from gru4rec.
@jellchou thank you!
from gru4rec.
Related Issues (20)
- hello,i have some questions about the code HOT 2
- About training time HOT 1
- Is it possible to output the embedding of user/session and item vectors? HOT 1
- NOT RNN MODEL HOT 2
- Additional Negative Sampling: Conditional Statement Logic Error HOT 1
- generate_samples function call in gru4rec.py HOT 2
- BPR loss implementation question
- Fit function in gru4rec.py missing data sort HOT 1
- predict_next_batch not considering other products in the same session HOT 2
- (Question) - How to use all items in a session for prediction? HOT 2
- No hidden state reset in get_metrics HOT 4
- Where is the data file ?
- theano error HOT 2
- Can you make a brief explaination on how you calculate recall ? HOT 2
- Incremental training (retrain) support removed
- ValueError: Input dimension mis-match. (input[2].shape[0] = 2080, input[3].shape[0] = 32)
- cuda error
- GFF code
- Testing Error:: start = offset_sessions[iters] IndexError: index 2 is out of bounds for axis 0 with size 2 HOT 1
- Evaluating baselines
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 gru4rec.